Optimize Docker image

This commit is contained in:
LordMathis 2019-11-02 17:58:41 +01:00
parent 30557fdd7e
commit 1fea3196d0
No known key found for this signature in database
GPG Key ID: 575849FD91CE470C
1 changed files with 13 additions and 4 deletions

View File

@ -1,9 +1,18 @@
FROM node:12 # Stage 1 - build app
WORKDIR /app FROM node:12 as build-deps
COPY . ./ WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN yarn RUN yarn
COPY . ./
RUN yarn build RUN yarn build
# Stage 2 - run
FROM node:12-alpine
WORKDIR /app
COPY --from=build-deps /usr/src/app/build /app/build
COPY --from=build-deps /usr/src/app/public /app/public
COPY --from=build-deps /usr/src/app/node_modules /app/node_modules
VOLUME /app/config VOLUME /app/config
VOLUME /app/content VOLUME /app/content
EXPOSE 3000 EXPOSE 3000
CMD [ "yarn", "start" ] CMD [ "node", "build/server.js" ]