-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (45 loc) · 1.02 KB
/
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
52
# ARG <name>[=<default value>]
# E.G.
# ARG SETTINGS
# RUN ./run/init-stuff $SETTINGS
# Set Node Version
ARG NODE_VERSION=22
# base build
FROM node:${NODE_VERSION}-alpine AS build
WORKDIR /app/apps
COPY apps/package.json ./
RUN npm i --only=production
WORKDIR /app
COPY package.json ./
RUN npm i --only=production
COPY . .
# FROM gcr.io/distroless/nodejs:debug
FROM gcr.io/distroless/nodejs:${NODE_VERSION} AS production
WORKDIR /app
COPY --from=build /app .
ARG ARG_API_PORT=3000
ARG ARG_NODE_ENV=prd
EXPOSE $ARG_API_PORT
EXPOSE 3001
ENV API_PORT $ARG_API_PORT
ENV NODE_ENV $ARG_NODE_ENV
ENV PORT $ARG_API_PORT
CMD ["index.js"]
FROM build AS development
WORKDIR /app
ARG ARG_API_PORT=3000
ARG ARG_NODE_ENV=dev
ENV NODE_ENV=$ARG_NODE_ENV
ENV API_PORT $ARG_API_PORT
ENV PORT $ARG_API_PORT
EXPOSE $ARG_API_PORT
RUN npm install
COPY --from=build /app .
CMD ["node", "index.js"]
FROM development AS test
ARG ARG_API_PORT=3000
ARG ARG_NODE_ENV=dev
ENV NODE_ENV=$ARG_NODE_ENV
ENV API_PORT $ARG_API_PORT
ENV PORT $ARG_API_PORT
CMD ["npm", "test"]