-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
61 lines (42 loc) · 1.36 KB
/
Dockerfile
File metadata and controls
61 lines (42 loc) · 1.36 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
# Global build arg — available in all stages
ARG APP_VERSION=dev
# ----- Stage 1: Build -----
FROM node:24-slim AS builder
ARG APP_VERSION
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
ENV APP_VERSION=${APP_VERSION}
RUN npm run build
RUN npm pkg delete scripts.prepare && npm ci --omit=dev
# ----- Stage 2: Runtime -----
FROM node:24-slim
ARG APP_VERSION
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ffmpeg \
python3 \
curl \
ca-certificates && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
groupadd -r scrolly && useradd -r -g scrolly -m scrolly
WORKDIR /app
COPY --from=builder /app/build ./build
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./
COPY --from=builder /app/src/lib/server/db/migrations ./migrations
RUN mkdir -p /app/data && chown -R scrolly:scrolly /app
ENV APP_VERSION=${APP_VERSION}
ENV NODE_ENV=production
ENV PORT=3000
# SvelteKit CSRF protection — must match the public URL when behind a reverse proxy.
# docker-compose.yml overrides this with PUBLIC_APP_URL or DOMAIN.
ENV ORIGIN=http://localhost:3000
VOLUME /app/data
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost:3000/api/health || exit 1
USER scrolly
CMD ["node", "build/index.js"]