-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (35 loc) · 1.37 KB
/
Dockerfile
File metadata and controls
46 lines (35 loc) · 1.37 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
# Use a consistent Node.js version across build and release stages
FROM node:23-slim AS builder
# Install Python for node-gyp (required for sqlite3 build)
RUN apt-get update && apt-get install -y python3 build-essential && \
ln -s /usr/bin/python3 /usr/bin/python && \
rm -rf /var/lib/apt/lists/*
WORKDIR /databus/server
COPY server/package*.json .
RUN --mount=type=bind,source=server/package.json,target=package.json \
--mount=type=cache,target=/root/.npm \
bash -c "if [ ! -f package-lock.json ]; then npm install --package-lock-only; fi && npm ci --omit=dev"
WORKDIR /databus/public
COPY public/package*.json .
RUN --mount=type=bind,source=public/package.json,target=package.json \
--mount=type=cache,target=/root/.npm \
bash -c "if [ ! -f package-lock.json ]; then npm install --package-lock-only; fi && npm ci --omit=dev"
WORKDIR /
# Copy source code
COPY server ./databus/server
COPY public ./databus/public
COPY search ./databus/search
# Rebuild sqlite3 in case it's a native module
# RUN cd databus/server && npm rebuild sqlite3
FROM node:23-slim AS runtime
WORKDIR /databus
# Install only necessary system packages
RUN apt-get update && \
apt-get install -y \
curl \
ca-certificates && \
rm -rf /var/lib/apt/lists/*
# Copy app from build stage
COPY --from=builder /databus .
# Entrypoint
ENTRYPOINT [ "/bin/bash", "./server/setup.sh" ]