Update Dockerfile.prod and .dockerignore

master
Dessa Simpson 2020-11-29 12:37:30 -07:00
parent aded3f4c77
commit 2751ccf846
2 changed files with 24 additions and 6 deletions

View File

@ -1,4 +1,7 @@
Dockerfile Dockerfile
Dockerfile.prod
docker-compose.yml
.dockerignore .dockerignore
.git .git
.gitignore .gitignore
node_modules

View File

@ -1,9 +1,24 @@
FROM node:latest FROM node:14 AS builder
COPY . /home/app
WORKDIR /home/app
USER node USER node
ENV PORT 3000
EXPOSE 3000
CMD ["ts-node", "./src/app.ts"] 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"]