-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (39 loc) · 1.33 KB
/
Dockerfile
File metadata and controls
54 lines (39 loc) · 1.33 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
FROM node:20-bookworm-slim AS builder
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
make \
g++ \
openssl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY package.json package-lock.json tsconfig.json biome.json vitest.config.ts ./
COPY prisma ./prisma
RUN npm ci
RUN npx prisma generate --schema=./prisma/schema.prisma
COPY src ./src
RUN npm run build
RUN npm prune --omit=dev
FROM node:20-bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
openssl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN groupadd -g 1001 nodejs && \
useradd -r -u 1001 -g nodejs -m -d /home/nodejs nodejs
WORKDIR /app
ENV NODE_ENV=production
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/package-lock.json ./package-lock.json
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/dist ./dist
COPY docker-entrypoint.sh ./docker-entrypoint.sh
RUN mkdir -p /app/data && \
chmod +x /app/docker-entrypoint.sh && \
chown -R nodejs:nodejs /app /home/nodejs
EXPOSE 8916
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=10 \
CMD curl -f http://localhost:8916/health || exit 1
ENTRYPOINT ["/app/docker-entrypoint.sh"]