-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (39 loc) · 1.4 KB
/
Dockerfile
File metadata and controls
54 lines (39 loc) · 1.4 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
# ---- Build stage ----
FROM node:22-slim AS builder
WORKDIR /app
# Build tools required to compile better-sqlite3 native bindings
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 make g++ \
&& rm -rf /var/lib/apt/lists/*
# Copy lockfiles and manifests first for layer caching
COPY server/package.json server/yarn.lock ./server/
COPY client/package.json client/yarn.lock ./client/
RUN yarn --cwd server install --frozen-lockfile \
&& yarn --cwd client install --frozen-lockfile
# Copy source
COPY server/src ./server/src
COPY client/src ./client/src
COPY client/index.html client/vite.config.js ./client/
RUN yarn --cwd client build
# ---- Production stage ----
FROM node:22-slim
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy compiled server dependencies (includes native better-sqlite3 binary)
COPY --from=builder /app/server/node_modules ./server/node_modules
COPY --from=builder /app/client/dist ./client/dist
COPY server/src ./server/src
COPY server/package.json ./server/
COPY package.json ./
RUN mkdir -p /data
ENV NODE_ENV=production \
PORT=3001 \
HOST=0.0.0.0 \
DB_PATH=/data/cronpilot.db
EXPOSE 3001
VOLUME /data
HEALTHCHECK --interval=30s --timeout=10s --start-period=20s --retries=3 \
CMD curl -f http://localhost:3001/ || exit 1
CMD ["node", "server/src/index.js"]