MEga push vol idk, chat function updates, docker fixes
This commit is contained in:
38
Dockerfile
38
Dockerfile
@@ -1,43 +1,59 @@
|
||||
# Build stage
|
||||
# ── Build stage ──
|
||||
FROM node:22-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
# Build args needed by $env/static/public at build time
|
||||
ARG PUBLIC_SUPABASE_URL
|
||||
ARG PUBLIC_SUPABASE_ANON_KEY
|
||||
|
||||
# Copy package files first for better layer caching
|
||||
COPY package*.json ./
|
||||
|
||||
# Install all dependencies (including dev)
|
||||
# Install all dependencies (including dev) needed for the build
|
||||
RUN npm ci
|
||||
|
||||
# Copy source files
|
||||
COPY . .
|
||||
|
||||
# Build the application
|
||||
# Build the SvelteKit application
|
||||
RUN npm run build
|
||||
|
||||
# Prune dev dependencies
|
||||
RUN npm prune --production
|
||||
# ── Production dependencies stage ──
|
||||
FROM node:22-alpine AS deps
|
||||
|
||||
# Production stage
|
||||
WORKDIR /app
|
||||
|
||||
COPY package*.json ./
|
||||
|
||||
# Install only production dependencies
|
||||
RUN npm ci --omit=dev
|
||||
|
||||
# ── Runtime stage ──
|
||||
FROM node:22-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy built application
|
||||
# Copy built application and production deps
|
||||
COPY --from=builder /app/build build/
|
||||
COPY --from=builder /app/node_modules node_modules/
|
||||
COPY --from=deps /app/node_modules node_modules/
|
||||
COPY package.json .
|
||||
|
||||
# Expose port
|
||||
EXPOSE 3000
|
||||
|
||||
# Set environment
|
||||
# Set environment defaults
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
ENV HOST=0.0.0.0
|
||||
# SvelteKit node adapter needs ORIGIN for CSRF protection
|
||||
# Override at runtime via docker-compose or -e flag
|
||||
ENV ORIGIN=http://localhost:3000
|
||||
# Allow file uploads up to 10 MB
|
||||
ENV BODY_SIZE_LIMIT=10485760
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
||||
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
|
||||
|
||||
# Run the application
|
||||
|
||||
Reference in New Issue
Block a user