deafgain-website/Dockerfile

39 lines
1 KiB
Docker

FROM node:20-alpine AS base
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app
# Create required directories
RUN mkdir -p /app/public/images/thumbnails \
/app/public/videos \
/app/public/subtitles \
/app/public/transcriptions
# Copy package files
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
COPY --from=builder /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Create videos directory
RUN mkdir -p /usr/share/nginx/html/videos
# Copy specific directories from public
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
EXPOSE 804
CMD ["nginx", "-g", "daemon off;"]