-
Notifications
You must be signed in to change notification settings - Fork 12
/
Dockerfile
39 lines (28 loc) · 966 Bytes
/
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
# build env
FROM node:20-alpine as build
WORKDIR /app
RUN apk add --no-cache git=~2
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile --non-interactive --ignore-scripts && yarn cache clean
COPY . .
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:20-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 ["yarn", "start"]