forked from AbdulmalikAlayande/sorokeep
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (29 loc) · 994 Bytes
/
Copy pathDockerfile
File metadata and controls
44 lines (29 loc) · 994 Bytes
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
# Stage 1: build
FROM node:22-alpine AS builder
# Install build tools needed for better-sqlite3 native addon
RUN apk add --no-cache python3 make g++
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY tsconfig.json ./
COPY src/ ./src/
RUN npm run build
# Stage 2: production image
FROM node:22-alpine AS production
ENV NODE_ENV=production
WORKDIR /app
COPY package*.json ./
# Install build tools, compile native addons, then remove build tools
RUN apk add --no-cache --virtual .build-deps python3 make g++ \
&& npm ci --omit=dev \
&& apk del .build-deps
# Copy compiled output from builder
COPY --from=builder /app/dist ./dist
# Create non-root user and data directory
RUN addgroup -S sorokeep && adduser -S sorokeep -G sorokeep \
&& mkdir -p /home/sorokeep/.sorokeep \
&& chown -R sorokeep:sorokeep /home/sorokeep /app
USER sorokeep
# Persist SQLite database across container restarts
VOLUME ["/home/sorokeep/.sorokeep"]
ENTRYPOINT ["node", "/app/dist/index.js"]