-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathDockerfile.k8s
More file actions
54 lines (40 loc) · 1.58 KB
/
Copy pathDockerfile.k8s
File metadata and controls
54 lines (40 loc) · 1.58 KB
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
53
54
# build env
FROM node:24-alpine AS build
ARG BUILD_VERSION=dev
ARG BUILD_BRANCH=develop
ARG BUILD_COMMIT=unknown
WORKDIR /app
RUN apk add --no-cache git=~2
# .yarn/releases is the committed yarn pinned by yarnPath in .yarnrc.yml;
# the stock Yarn 1 from the node image delegates to it — no corepack needed
COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn/releases .yarn/releases
# copy with validate_addresses JSON file
# COPY package.json yarn.lock .yarnrc.yml validate_addresses.example.json ./
RUN yarn install --immutable --mode=skip-build && yarn cache clean --all
COPY . .
# Populate build-info.json
RUN sed -i "s|REPLACE_WITH_VERSION|$BUILD_VERSION|" build-info.json && \
sed -i "s|REPLACE_WITH_BRANCH|$BUILD_BRANCH|" build-info.json && \
sed -i "s|REPLACE_WITH_COMMIT|$BUILD_COMMIT|" build-info.json
RUN NODE_NO_BUILD_DYNAMICS=true yarn build
# public/runtime is used to inject runtime vars; it should exist and user node should have write access there for it
RUN rm -rf /app/public/runtime && mkdir /app/public/runtime && chown node /app/public/runtime
# final image
FROM node:24-alpine AS base
ARG BASE_PATH=""
ARG SUPPORTED_CHAINS="1"
ARG DEFAULT_CHAIN="1"
ENV NEXT_TELEMETRY_DISABLED=1 \
BASE_PATH=$BASE_PATH \
SUPPORTED_CHAINS=$SUPPORTED_CHAINS \
DEFAULT_CHAIN=$DEFAULT_CHAIN
WORKDIR /app
RUN apk add --no-cache curl=~8
COPY --from=build /app /app
RUN chown -R node:node /app/.next
USER node
EXPOSE 3000
HEALTHCHECK --interval=10s --timeout=3s \
CMD curl -f http://localhost:3000/api/health || exit 1
CMD ["sh", "-c", "source /vault/secrets/app && exec yarn start"]