- Updated docker-compose.yml to include environment variable support for services, enhancing flexibility in configuration. - Refactored Dockerfile to utilize build arguments for VITE environment variables, allowing for better customization during builds. - Improved Nginx configuration to handle larger video uploads by increasing client_max_body_size to 5GB. - Enhanced backend Dockerfile to include wget for health checks and improved startup logging for database migrations. - Added validation for critical environment variables in the backend to ensure necessary configurations are present before application startup. - Updated content streaming logic to support direct HLS URL construction, improving streaming reliability and user experience. - Refactored various components and services to streamline access checks and improve error handling during content playback.
32 lines
1.1 KiB
Docker
32 lines
1.1 KiB
Docker
FROM node:20-alpine AS builder
|
|
WORKDIR /app
|
|
|
|
# Copy package files first for better caching
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --ignore-scripts
|
|
|
|
# Copy source and build
|
|
COPY . .
|
|
RUN npm run build
|
|
RUN npm prune --production
|
|
|
|
# ── Production image ──────────────────────────────────────────
|
|
FROM node:20-alpine AS production
|
|
WORKDIR /app
|
|
|
|
# wget is needed for Docker/Portainer health checks
|
|
RUN apk add --no-cache wget
|
|
|
|
COPY --from=builder /app/package.json ./package.json
|
|
COPY --from=builder /app/package-lock.json ./package-lock.json
|
|
COPY --from=builder /app/dist ./dist
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
|
|
EXPOSE 4000
|
|
|
|
ENV NODE_OPTIONS="--max-old-space-size=1024"
|
|
|
|
# Run TypeORM migrations on startup, then start the API.
|
|
# Migration errors are logged (not suppressed) so failed deploys are visible.
|
|
CMD ["sh", "-c", "echo 'Running database migrations...' && npx typeorm migration:run -d dist/database/ormconfig.js && echo 'Migrations complete.' && npm run start:prod"]
|