-
Notifications
You must be signed in to change notification settings - Fork 10
/
dockerfile
33 lines (29 loc) · 858 Bytes
/
dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
###################
# BUILD FOR LOCAL DEVELOPMENT
###################
FROM node:18-alpine as development
WORKDIR /app
###################
# BUILD FOR PRODUCTION
###################
FROM development as build
# Install app dependencies
COPY . .
ENV NPM_CONFIG_LOGLEVEL warn
ENV NODE_ENV=PRODUCTION
RUN npm install
RUN npm run build
RUN npm prune --production
USER node
###################
# BUILD FOR PRODUCTION
###################
FROM development as production
COPY --chown=node:node --from=build /app/dist /app/dist
COPY --chown=node:node --from=build /app/node_modules /app/node_modules
COPY --chown=node:node --from=build /app/.env /app/.env
COPY --chown=node:node --from=build /app/ecosystem.config.js /app/ecosystem.config.js
COPY --chown=node:node --from=build /app/package.json /app/package.json
CMD ["node", "dist/main.js"]
EXPOSE 3000
USER node