deafgain-website/Dockerfile
TheMaddax e3930cf87a Fix nginx logging configuration for statistics
- Create log directory in Dockerfile
- Add proper logging configuration to default.conf
- Mount logs directory in docker-compose.yml for persistence
- Fixes 502 error caused by missing log directory
2025-05-27 12:54:13 -05:00

39 lines
1.1 KiB
Docker

FROM node:20-alpine AS base
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app
# Copy package files first
COPY package.json pnpm-lock.yaml ./
# Install dependencies
FROM base AS deps
RUN pnpm install --frozen-lockfile
# Build the app
FROM base AS builder
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN pnpm build
# Production image
FROM nginx:alpine AS runner
# Create required directories for web content and logs
RUN mkdir -p /usr/share/nginx/html/images/thumbnails \
/usr/share/nginx/html/subtitles \
/usr/share/nginx/html/transcriptions \
/usr/share/nginx/html/videos \
/var/log/nginx/deafgain-website
# Copy built app and static assets
COPY --from=builder /app/dist /usr/share/nginx/html
COPY --from=builder /app/public/images/ /usr/share/nginx/html/images/
COPY --from=builder /app/public/subtitles /usr/share/nginx/html/subtitles
COPY --from=builder /app/public/transcriptions /usr/share/nginx/html/transcriptions
# Copy nginx configuration
COPY default.conf /etc/nginx/conf.d/default.conf
EXPOSE 804
CMD ["nginx", "-g", "daemon off;"]