learn-request-queue/Dockerfile.prod

25 lines
610 B
Docker

FROM node:14 AS builder
USER node
ENV PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/app/node_modules/.bin"
COPY --chown=node . /app
WORKDIR /app
RUN ["npm", "install"]
RUN ["tsc", "--outDir", "build"]
FROM node:14-alpine
EXPOSE 3000
ENV PORT 3000
ENV PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/app/node_modules/.bin" NODE_ENV="production"
USER node
WORKDIR /app
COPY --from=builder /app/build build
COPY --from=builder /app/node_modules node_modules
COPY --from=builder /app/public public
COPY --from=builder /app/views views
CMD ["node", "./build/app.js"]