61 lines
2.3 KiB
Docker
61 lines
2.3 KiB
Docker
FROM node:20-alpine AS base
|
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
|
WORKDIR /app
|
|
|
|
# Create required directories
|
|
RUN mkdir -p public/images/thumbnails public/subtitles public/transcriptions
|
|
|
|
# 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 . .
|
|
# Verification steps with output to file
|
|
RUN echo "=== BUILDER STAGE: Verifying source files ===" > /verification.txt && \
|
|
echo "Contents of /app/public:" >> /verification.txt && \
|
|
ls -la /app/public >> /verification.txt && \
|
|
echo "\nContents of /app/public/images:" >> /verification.txt && \
|
|
ls -la /app/public/images >> /verification.txt && \
|
|
echo "\nContents of /app/public/images/thumbnails:" >> /verification.txt && \
|
|
ls -la /app/public/images/thumbnails >> /verification.txt && \
|
|
echo "\nAll files under public:" >> /verification.txt && \
|
|
find /app/public -type f >> /verification.txt
|
|
RUN pnpm build
|
|
|
|
# Production image
|
|
FROM nginx:alpine AS runner
|
|
|
|
# Create required directories
|
|
RUN mkdir -p /usr/share/nginx/html/images/thumbnails \
|
|
/usr/share/nginx/html/subtitles \
|
|
/usr/share/nginx/html/transcriptions \
|
|
/usr/share/nginx/html/videos
|
|
|
|
# Copy verification file from builder
|
|
COPY --from=builder /verification.txt /verification.txt
|
|
|
|
# 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.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Add runner stage verification to the file
|
|
RUN echo "\n=== RUNNER STAGE: Verifying nginx html directory structure ===" >> /verification.txt && \
|
|
echo "Contents of /usr/share/nginx/html:" >> /verification.txt && \
|
|
ls -la /usr/share/nginx/html >> /verification.txt && \
|
|
echo "\nContents of /usr/share/nginx/html/images:" >> /verification.txt && \
|
|
ls -la /usr/share/nginx/html/images >> /verification.txt && \
|
|
echo "\nAll files under html:" >> /verification.txt && \
|
|
find /usr/share/nginx/html -type f >> /verification.txt
|
|
|
|
EXPOSE 804
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|