Files
redlight/Dockerfile
Michelle cd98ee4cc7
All checks were successful
Build & Push Docker Image / build (push) Successful in 1m10s
add branding option
2026-02-24 19:43:59 +01:00

45 lines
1.2 KiB
Docker

# ── Stage 1: Build frontend ──────────────────────────────────────────────────
FROM node:20-alpine AS builder
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci
COPY . .
RUN npm run build
# ── Stage 2: Production image ───────────────────────────────────────────────
FROM node:20-alpine
# better-sqlite3 needs build tools for native compilation
RUN apk add --no-cache python3 make g++
WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm ci --omit=dev && npm cache clean --force
# Remove build tools after install to keep image smaller
RUN apk del python3 make g++
# Copy server code
COPY server/ ./server/
# Copy built frontend from builder stage
COPY --from=builder /app/dist ./dist
# Create uploads directory
RUN mkdir -p uploads/avatars uploads/branding
ENV NODE_ENV=production
ENV PORT=3001
ENV SQLITE_PATH=/app/data/redlight.db
EXPOSE 3001
# Data volumes for persistent storage
VOLUME ["/app/uploads", "/app/data"]
CMD ["node", "server/index.js"]