-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
49 lines (36 loc) · 1.1 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
FROM node:22-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 app
FROM node AS app-build
WORKDIR /app
ENV RUNTIME_ENVIRONMENT ${RUNTIME_ENVIRONMENT}
COPY ./app ./app
COPY ./mocks ./mocks
COPY ./public ./public
COPY ./vite.config.ts ./
COPY ./package.json ./
COPY ./package-lock.json ./
RUN npm ci --ignore-scripts
RUN npm run build
# install dependencies
FROM node AS app-dependencies
WORKDIR /app
COPY ./package.json ./
COPY ./package-lock.json ./
RUN npm ci --ignore-scripts --omit dev
FROM scratch AS export
COPY --from=app-build /app/build /
# 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 ./public ./public/
COPY ./package.json ./package.json
COPY --from=app-build /app/build/ ./build/
COPY --from=app-dependencies /app/node_modules ./node_modules
CMD ["./node_modules/@remix-run/serve/dist/cli.js", "./build/server/index.js"]