This commit is contained in:
Ccjcarkbla
2026-06-13 08:03:45 -04:00
parent cfcd6ae11e
commit a2c300678b
121 changed files with 8639 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
# ── Stage 1: install production dependencies ──────────────────────────────────
FROM node:20-alpine AS deps
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev && npm cache clean --force
# ── Stage 2: runtime image ────────────────────────────────────────────────────
FROM node:20-alpine
# tini: PID 1 signal forwarding + zombie reaping
RUN apk add --no-cache tini
WORKDIR /app
# Copy production node_modules from deps stage
COPY --from=deps /app/node_modules ./node_modules
# Copy application source (respects .dockerignore)
COPY . .
# Runtime data directories — overridden by volume mounts in production.
# The 'node' user already exists in the official node image.
RUN mkdir -p /data/uploads /data/tmp \
&& chown -R node:node /app /data
USER node
ENV NODE_ENV=production \
PORT=3000 \
DB_PATH=/data/vitfit.sqlite \
UPLOADS_DIR=/data/uploads \
UPLOAD_TEMP_DIR=/data/tmp
EXPOSE 3000
# /health is unauthenticated and checks DB connectivity + disk
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD wget -qO- http://localhost:3000/health || exit 1
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["node", "app.js"]