-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
48 lines (33 loc) · 1.15 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
# -- BUILD STAGE --------------------------------
FROM node:16.14.0 AS build
WORKDIR /src
# Define build arguments & map them to environment variables
ARG NPM_TOKEN
ARG FONTAWESOME_TOKEN
ENV NEXT_TELEMETRY_DISABLED=1
# Build the project and then dispose files not necessary to run the project
# This will make the runtime image as small as possible
COPY package.json ./
COPY yarn.lock ./
COPY .npmrc ./
RUN yarn install --frozen-lockfile
COPY next-env.d.ts ./
COPY next.config.js ./
RUN npx next telemetry disable > /dev/null
COPY tsconfig.json ./
COPY src ./src/
COPY public ./public/
RUN yarn build
# -- RUNTIME STAGE --------------------------------
FROM gcr.io/distroless/nodejs:16
WORKDIR /app
# copy in our healthcheck binary
COPY --from=ghcr.io/bratteng/healthcheck:latest --chown=nonroot /healthcheck /healthcheck
COPY --from=build /src/.next/standalone /app/
COPY --from=build /src/.next/static /app/.next/static
COPY --from=build /src/public /app/public
# default next.js port
EXPOSE 3000
# healthcheck to report the container status
HEALTHCHECK --interval=5s --timeout=10s --retries=3 CMD [ "/healthcheck", "-port", "3000" ]
CMD ["/app/server.js"]