-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (26 loc) · 1.08 KB
/
Dockerfile
File metadata and controls
39 lines (26 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
37
38
39
# ── Stage 1: deps (build native modules) ─────────────────────────────────────
FROM node:22-alpine AS deps
WORKDIR /build
# Required to compile better-sqlite3 native addon
RUN apk add --no-cache python3 make g++
COPY backend/package.json ./
RUN npm install --omit=dev
# ── Stage 2: runtime ──────────────────────────────────────────────────────────
FROM node:22-alpine
# tini for proper PID 1 signal handling
RUN apk add --no-cache tini
WORKDIR /app
# Copy production node_modules from deps stage
COPY --from=deps /build/node_modules ./backend/node_modules
# Copy application source
COPY backend/ ./backend/
COPY frontend/ ./frontend/
# Create data directory for SQLite volume mount
RUN mkdir -p /data
# Non-root user
RUN addgroup -S snake && adduser -S snake -G snake \
&& chown -R snake:snake /app /data
USER snake
EXPOSE 3000
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["node", "backend/server.js"]