Update Dockerfile.prod and .dockerignore
parent
aded3f4c77
commit
2751ccf846
|
@ -1,4 +1,7 @@
|
|||
Dockerfile
|
||||
Dockerfile.prod
|
||||
docker-compose.yml
|
||||
.dockerignore
|
||||
.git
|
||||
.gitignore
|
||||
node_modules
|
||||
|
|
|
@ -1,9 +1,24 @@
|
|||
FROM node:latest
|
||||
FROM node:14 AS builder
|
||||
|
||||
COPY . /home/app
|
||||
WORKDIR /home/app
|
||||
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"]
|
||||
|
|
Loading…
Reference in New Issue