Optimize Docker image
This commit is contained in:
parent
30557fdd7e
commit
1fea3196d0
17
Dockerfile
17
Dockerfile
|
@ -1,9 +1,18 @@
|
|||
FROM node:12
|
||||
WORKDIR /app
|
||||
COPY . ./
|
||||
# Stage 1 - build app
|
||||
FROM node:12 as build-deps
|
||||
WORKDIR /usr/src/app
|
||||
COPY package.json yarn.lock ./
|
||||
RUN yarn
|
||||
COPY . ./
|
||||
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/content
|
||||
EXPOSE 3000
|
||||
CMD [ "yarn", "start" ]
|
||||
CMD [ "node", "build/server.js" ]
|
||||
|
|
Loading…
Reference in New Issue