-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (29 loc) · 1.1 KB
/
Copy pathDockerfile
File metadata and controls
38 lines (29 loc) · 1.1 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
# ---------- build ----------
FROM node:24-alpine AS builder
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build
# ---------- run ----------
FROM node:24-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production \
PORT=3000 \
HOSTNAME=0.0.0.0 \
LMS_DATA_DIR=/data \
NODE_OPTIONS=--disable-warning=ExperimentalWarning
RUN addgroup -g 1001 -S lms && adduser -u 1001 -S lms -G lms
# The standalone server plus its static assets.
COPY --from=builder --chown=lms:lms /app/.next/standalone ./
COPY --from=builder --chown=lms:lms /app/.next/static ./.next/static
# Admin bootstrap script needs the schema, which lives in src/lib/db.ts.
COPY --from=builder --chown=lms:lms /app/scripts ./scripts
COPY --from=builder --chown=lms:lms /app/src/lib/db.ts ./src/lib/db.ts
RUN mkdir -p /data/scorm && chown -R lms:lms /data
VOLUME ["/data"]
USER lms
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD node -e "fetch('http://127.0.0.1:3000/api/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
CMD ["node", "server.js"]