-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
51 lines (34 loc) · 964 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
46
47
48
49
50
51
# syntax=docker/dockerfile:1
ARG node_env=production
FROM node:16.16 as builder
ENV NODE_ENV $node_env
ENV HOST=0.0.0.0
RUN npm install --location=global [email protected]
RUN npm install --location=global nodemon
WORKDIR /app
COPY *.json ./
RUN npm install --omit=dev
COPY favicon.ico .
COPY *.js ./
CMD [ "node", "index.js" ]
FROM node:16.16 as pkg
RUN npm install --location=global [email protected]
# https://www.npmjs.com/package/pkg
RUN npm install --location=global pkg
ENV NODE_ENV=production
ENV HOST=0.0.0.0
ENV PORT=3000
EXPOSE 3000
WORKDIR /app
COPY --from=builder /app /app
RUN pkg package.json
CMD [ "/app/dist/cloud-native-weather-nodejs" ]
FROM gcr.io/distroless/cc-debian11 as runtime
ENV NODE_ENV=production
ENV HOST=0.0.0.0
ENV PORT=3000
EXPOSE 3000
WORKDIR /app
COPY --from=pkg /app/favicon.ico /app/favicon.ico
COPY --from=pkg /app/dist/cloud-native-weather-nodejs /app/cloud-native-weather-nodejs
CMD [ "/app/cloud-native-weather-nodejs" ]