-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
45 lines (27 loc) · 800 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
34
35
36
37
38
39
40
41
42
43
44
45
# DEVELOPMENT
FROM node:18.12-alpine AS development
WORKDIR /app/
COPY --chown=node:node package*.json src/* ./
RUN npm ci
COPY --chown=node:node . .
USER node
# BUILD
FROM node:18.12-alpine AS build
WORKDIR /app/
COPY --chown=node:node package*.json ./
COPY --chown=node:node --from=development /app/node_modules ./node_modules
COPY --chown=node:node . .
RUN npm run build
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
RUN npm ci --omit=dev && npm cache clean --force
USER node
# PRODUCTION
FROM node:18.12-alpine AS production
WORKDIR /app/
COPY --chown=node:node --from=build /app/dist ./
COPY --chown=node:node --from=build /app/node_modules ./node_modules
COPY --chown=node:node --from=build /app/src/views ./views
EXPOSE 4000
ARG color=auto
ENTRYPOINT ["node", "index.js"]