-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (34 loc) · 1.49 KB
/
Copy pathDockerfile
File metadata and controls
42 lines (34 loc) · 1.49 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
# syntax=docker/dockerfile:1
FROM node:22-alpine AS builder
RUN apk add --no-cache git
WORKDIR /app
COPY package.json package-lock.json* ./
COPY packages/api/package.json ./packages/api/
COPY packages/web/package.json ./packages/web/
RUN npm ci
COPY packages/api ./packages/api
COPY packages/web ./packages/web
COPY .git ./.git
RUN cd packages/api && npx prisma generate
RUN cd packages/api && npm run build
RUN cd packages/web && npm run build
# Remove devDependencies (build tools incl. esbuild Go binaries) before copying to runtime
RUN npm prune --omit=dev
# ── Runtime ──────────────────────────────────────────────
FROM node:22-alpine AS runtime
RUN apk upgrade --no-cache && npm install -g npm@latest
WORKDIR /app
COPY --from=builder /app/packages/api/dist ./packages/api/dist
COPY --from=builder /app/packages/api/node_modules ./packages/api/node_modules
COPY --from=builder /app/packages/api/prisma ./packages/api/prisma
COPY --from=builder /app/packages/api/package.json ./packages/api/package.json
COPY --from=builder /app/packages/web/dist ./packages/web/dist
COPY --from=builder /app/node_modules ./node_modules
COPY package.json ./
ENV NODE_ENV=production
ENV PORT=3000
ENV HOST=0.0.0.0
ENV DATA_DIR=/data
EXPOSE 3000
CMD ["sh", "-c", \
"export DATABASE_URL=\"file:${DATA_DIR}/visualizer.db\" && cd packages/api && npx prisma migrate deploy && node dist/app.js"]