-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
91 lines (75 loc) · 2.11 KB
/
Copy pathDockerfile
File metadata and controls
91 lines (75 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# ========================================
# Stage 1: Build Frontend
# ========================================
FROM node:20-alpine AS frontend-builder
WORKDIR /build
# Base path for frontend (default: / for direct access)
ARG VITE_BASE_PATH=/
# Install build dependencies for native modules
RUN apk add --no-cache python3 make g++
# Copy frontend package files
COPY frontend/package*.json ./
# Use npm install instead of npm ci for better multi-arch compatibility
RUN npm install --legacy-peer-deps
# Copy frontend source and build with base path
COPY frontend/ ./
ENV VITE_BASE_PATH=${VITE_BASE_PATH}
RUN npm run build
# ========================================
# Stage 2: Production
# ========================================
FROM node:20-alpine
# ----------------------
# Dépendances système
# ----------------------
RUN apk add --no-cache \
python3 \
py3-pip \
mediainfo \
mktorrent \
bash \
git \
build-base \
curl \
jq
# ----------------------
# Python : venv pour PEP 668
# ----------------------
RUN python3 -m venv /opt/venv \
&& /opt/venv/bin/pip install --upgrade pip \
&& /opt/venv/bin/pip install --no-cache-dir guessit
ENV PATH="/opt/venv/bin:$PATH"
# ----------------------
# Backend Node.js dependencies
# ----------------------
WORKDIR /app
COPY package*.json ./
RUN npm install --omit=dev --legacy-peer-deps
# ----------------------
# Copy backend code
# ----------------------
COPY backend/ ./backend/
COPY scene-maker.js ./
COPY docker-entrypoint.sh ./
RUN chmod +x docker-entrypoint.sh scene-maker.js
# ----------------------
# Copy frontend build from stage 1
# ----------------------
COPY --from=frontend-builder /build/dist ./frontend/dist
# ----------------------
# Environment variables
# ----------------------
ENV WEB_PORT=3000
ENV NODE_ENV=production
# ----------------------
# Data directory (config only, media volumes configured by user)
# ----------------------
RUN mkdir -p /data/config
# ----------------------
# Expose web port
# ----------------------
EXPOSE 3000
# ----------------------
# Lancement
# ----------------------
CMD ["node", "backend/server.js"]