add environment for production
This commit is contained in:
40
Dockerfile
Normal file
40
Dockerfile
Normal file
@ -0,0 +1,40 @@
|
||||
FROM node:22-alpine AS base
|
||||
|
||||
RUN apk update && apk add git
|
||||
|
||||
COPY package.json ./
|
||||
|
||||
RUN npm install
|
||||
#RUN npm install typescript -g
|
||||
|
||||
# add folder if needs more
|
||||
COPY src ./src
|
||||
# COPY config ./config
|
||||
# COPY assets ./assets
|
||||
COPY public ./public
|
||||
|
||||
COPY tsconfig.json ./tsconfig.json
|
||||
|
||||
ENV NODE_ENV=prod
|
||||
# RUN npm run swagger
|
||||
|
||||
RUN npm run build:production
|
||||
|
||||
FROM node:22-alpine
|
||||
|
||||
# Copy node modules and build directory from base image to new image
|
||||
COPY --from=base ./node_modules ./node_modules
|
||||
COPY --from=base ./package.json ./package.json
|
||||
COPY --from=base /dist /dist
|
||||
# COPY --from=base /config /config
|
||||
# COPY --from=base /config /dist/config
|
||||
# COPY --from=base /assets /assets
|
||||
COPY --from=base /src /src
|
||||
COPY --from=base /public /public
|
||||
|
||||
# Expose required port
|
||||
# CMD ["npm", "run", "start"]
|
||||
FROM nginx:alpine
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Reference in New Issue
Block a user