-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
63 lines (45 loc) · 1.45 KB
/
Dockerfile
File metadata and controls
63 lines (45 loc) · 1.45 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
55
56
57
58
59
60
61
62
63
# ---- 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 manifest first for layer caching
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
# Copy source
COPY server/src ./server/src
COPY client/src ./client/src
COPY client/index.html ./client/
COPY vite.config.js ./
RUN yarn build
# ---- Production deps stage ----
FROM node:22-slim AS deps
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 package.json yarn.lock ./
RUN yarn install --frozen-lockfile --production
# ---- 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 --from=deps /app/node_modules ./node_modules
COPY --from=builder /app/client/dist ./client/dist
COPY server/src ./server/src
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"]