-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (24 loc) · 1.08 KB
/
Dockerfile
File metadata and controls
36 lines (24 loc) · 1.08 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
FROM --platform=$BUILDPLATFORM node:22-bookworm-slim AS builder
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile --ignore-scripts --ignore-engines
COPY . .
RUN yarn build && yarn bundle
FROM --platform=$TARGETPLATFORM node:22-bookworm AS deps
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --production --ignore-engines --network-timeout 600000
FROM node:22-bookworm-slim
RUN groupadd -g 1001 gryt && useradd -m -u 1001 -g 1001 -d /app -s /usr/sbin/nologin gryt
WORKDIR /app
ARG VERSION=1.0.0
ENV NODE_ENV=production SERVER_VERSION=${VERSION}
COPY --from=deps --chown=gryt:gryt /app/node_modules ./node_modules
COPY --from=builder --chown=gryt:gryt /app/dist/bundle.js ./bundle.js
COPY --from=builder --chown=gryt:gryt /app/dist/admin-setOwner.js ./admin-setOwner.js
RUN mkdir -p /data && chown -R gryt:gryt /data
USER gryt
EXPOSE 5000
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD node -e "fetch('http://localhost:5000/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
CMD ["node", "bundle.js"]