-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
47 lines (38 loc) · 1.11 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
FROM node:lts-alpine as node
RUN --mount=type=secret,id=NODE_AUTH_TOKEN \
npm config set //npm.pkg.github.com/:_authToken=$(cat /run/secrets/NODE_AUTH_TOKEN)
RUN npm config set @navikt:registry=https://npm.pkg.github.com
# build client
FROM node as client-builder
ENV HUSKY=0
WORKDIR /app
COPY client/package.json client/package-lock.json ./
RUN npm ci
COPY client .
RUN npm run test:ci && npm run build
# build server
FROM node as server-builder
ENV HUSKY=0
WORKDIR /app
COPY server/package.json server/package-lock.json ./
RUN npm ci
COPY server .
RUN npm run build
# install server dependencies
FROM node as server-dependencies
ENV HUSKY=0
WORKDIR /app
COPY server/package.json server/package-lock.json ./
RUN npm ci --omit dev
# runtime
FROM gcr.io/distroless/nodejs22-debian12 as runtime
WORKDIR /app
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
ENV TZ="Europe/Oslo"
EXPOSE 3000
COPY --from=client-builder /app/dist ./client/dist
COPY --from=server-builder /app/dist ./server/dist
WORKDIR /app/server
COPY --from=server-dependencies /app/node_modules ./node_modules
CMD [ "--enable-source-maps", "dist/server.mjs" ]