-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (27 loc) · 902 Bytes
/
Copy pathDockerfile
File metadata and controls
31 lines (27 loc) · 902 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
# ---- deps stage: install & compile native modules (better-sqlite3) ----
FROM node:20-bookworm-slim AS deps
WORKDIR /app
# build-essential + python3 are only needed as a fallback if prebuild-install
# can't find a prebuilt binary for the target platform; harmless either way
# since this stage's tools never reach the final image.
RUN apt-get update \
&& apt-get install -y --no-install-recommends python3 make g++ \
&& rm -rf /var/lib/apt/lists/*
COPY package.json package-lock.json ./
RUN npm ci --omit=dev
# ---- runtime stage ----
FROM node:20-bookworm-slim
WORKDIR /app
ENV NODE_ENV=production \
DB_PATH=/data/library.db \
PORT=3000
COPY --from=deps /app/node_modules ./node_modules
COPY package.json ./
COPY server ./server
COPY public ./public
COPY migrations ./migrations
COPY config ./config
RUN mkdir -p /data
VOLUME ["/data"]
EXPOSE 3000
CMD ["node", "server/index.js"]