Files
redlight/Dockerfile
Miichelle ffb7a45bfc
All checks were successful
Build & Push Docker Image / build (push) Successful in 6m5s
Try arm64 build
2026-02-27 14:50:09 +01:00

49 lines
1.5 KiB
Docker

# ── Stage 1: Build frontend ──────────────────────────────────────────────────
FROM node:20-bullseye-slim AS builder
WORKDIR /app
# Install build tools and sqlite headers for native modules
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 build-essential libsqlite3-dev ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY package.json package-lock.json* ./
RUN npm ci
COPY . .
RUN npm run build
# Produce production node_modules (compile native modules here for the target arch)
RUN npm ci --omit=dev && npm cache clean --force
# ── Stage 2: Production image ───────────────────────────────────────────────
FROM node:20-bullseye-slim
# Allow forcing build from source (useful when prebuilt binaries are not available)
ARG BUILD_FROM_SOURCE=false
ENV npm_config_build_from_source=${BUILD_FROM_SOURCE}
WORKDIR /app
# Copy production node_modules and built frontend from builder stage
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
# Copy server code
COPY server/ ./server/
# 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"]