Dockerfile (642B)
1 # pull official base image 2 FROM node:13.12.0-alpine AS client 3 4 ENV NODE_ENV=production 5 6 # set working directory 7 WORKDIR /app 8 9 # add `/app/node_modules/.bin` to $PATH 10 ENV PATH /app/node_modules/.bin:$PATH 11 12 # install app dependencies 13 COPY client/package.json ./ 14 COPY client/yarn.lock ./ 15 RUN yarn install 16 17 # build app 18 COPY client ./ 19 RUN yarn build 20 21 FROM node:13.12.0-alpine 22 23 ENV NODE_ENV=production 24 25 # set working directory 26 WORKDIR /app 27 28 # install app dependencies 29 COPY server/package.json ./ 30 COPY server/package-lock.json ./ 31 RUN npm install 32 33 # run app 34 COPY server ./ 35 COPY --from=client /app/build ./public 36 37 EXPOSE 5000 38 CMD ["node", "index.js"]