first commit
This commit is contained in:
+56
@@ -0,0 +1,56 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# -------------------- Build stage --------------------
|
||||
FROM node:20-bullseye AS builder
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies
|
||||
COPY package*.json ./
|
||||
RUN npm ci
|
||||
|
||||
# Copy sources
|
||||
COPY . .
|
||||
|
||||
# Build Angular app (outputs to ./dist)
|
||||
RUN npx ng build --configuration=production
|
||||
|
||||
# Prune dev dependencies to keep only production deps for runtime copy
|
||||
RUN npm prune --omit=dev
|
||||
|
||||
# -------------------- Runtime stage --------------------
|
||||
FROM node:20-bullseye-slim AS runner
|
||||
ENV NODE_ENV=production \
|
||||
YOUTUBE_DL_SKIP_PYTHON_CHECK=1
|
||||
WORKDIR /app
|
||||
|
||||
# Create required runtime directories
|
||||
RUN mkdir -p /app/db /app/tmp/downloads
|
||||
|
||||
# youtube-dl-exec (yt-dlp) requires Python at runtime
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends python3 python-is-python3 ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy runtime server and built frontend
|
||||
COPY --from=builder /app/server ./server
|
||||
COPY --from=builder /app/dist ./dist
|
||||
# Copy only the DB schema; the actual DB file will be created on first run
|
||||
COPY --from=builder /app/db/schema.sql ./db/schema.sql
|
||||
|
||||
# Copy production dependencies from builder
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
COPY --from=builder /app/package*.json ./
|
||||
|
||||
# Copy config
|
||||
COPY --from=builder /app/assets/config.local.js ./assets/config.local.js
|
||||
|
||||
# Après la ligne COPY pour config.local.js
|
||||
RUN ls -la /app/assets/ && \
|
||||
echo "Contenu de config.local.js:" && \
|
||||
cat /app/assets/config.local.js || echo "Fichier config.local.js non trouvé"
|
||||
|
||||
# Expose API/web port
|
||||
EXPOSE 4000
|
||||
|
||||
# Start the API server (serves the Angular build from ./dist)
|
||||
CMD ["node", "./server/index.mjs"]
|
||||
Reference in New Issue
Block a user