-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile
More file actions
68 lines (54 loc) · 2.41 KB
/
Copy pathDockerfile
File metadata and controls
68 lines (54 loc) · 2.41 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
64
65
66
67
68
FROM node:22-alpine AS builder
# Build frontend (Tailwind CSS + JS bundle)
WORKDIR /build
COPY package.json tailwind.config.js build.mjs ./
COPY src ./src
COPY static ./static
RUN npm install
RUN npm run build
FROM node:22-alpine
# Install runtime dependencies + Apprise
RUN apk add --no-cache git bash curl python3 py3-pip jq && \
pip3 install --no-cache-dir --break-system-packages apprise
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies (only re-runs when package.json / package-lock.json change)
# Copying the lockfile ensures: (a) deterministic installs via `npm ci`,
# (b) bumping an unpinned git dep (e.g. amule-ec-node#main) by updating the
# resolved SHA in the lockfile correctly invalidates this layer — without it,
# Docker would reuse the cached npm install even when the upstream dep moved.
# Build tools needed for better-sqlite3 native addon, removed after.
COPY server/package.json server/package-lock.json ./server/
RUN apk add --no-cache --virtual .build-deps make g++ python3 && \
npm ci --prefix server --omit=dev && \
apk del .build-deps
# Copy server source code (changes here don't invalidate npm install cache)
COPY server/server.js ./server/
COPY server/database.js ./server/
COPY server/lib ./server/lib
COPY server/middleware ./server/middleware
COPY server/modules ./server/modules
# Copy static assets (HTML, images, icons, manifest - no source JS)
COPY static/index.html ./static/
COPY static/*.png static/*.ico static/*.svg static/site.webmanifest ./static/
COPY static/service-icons ./static/service-icons
COPY static/flags ./static/flags
# Copy built assets from builder stage (CSS + JS bundle)
COPY --from=builder /build/static/output.css ./static/output.css
COPY --from=builder /build/static/dist ./static/dist
# Copy changelog for version info
COPY CHANGELOG.md ./
# Copy user scripts directory (custom event scripts)
COPY scripts ./scripts
# Create logs and data directories with proper permissions
# Make user scripts executable
RUN mkdir -p server/logs server/data && \
chmod -R 777 server/logs server/data && \
chmod +x scripts/*.sh
# Set Docker environment variable for UI warnings
ENV RUNNING_IN_DOCKER=true
# Expose port
EXPOSE 4000
# Start the application
# Set NODE_INSPECT=true to enable remote debugging on port 9229
CMD [ "sh", "-c", "if [ \"$NODE_INSPECT\" = 'true' ]; then exec node --inspect=0.0.0.0:9229 server/server.js; else exec node server/server.js; fi" ]