wokogaming commited on
Commit
dc3f932
·
verified ·
1 Parent(s): 05abd64

Upload 4 files

Browse files
Files changed (4) hide show
  1. Dockerfile +90 -10
  2. docker-compose.yml +22 -0
  3. nginx.conf +33 -0
  4. start.sh +15 -0
Dockerfile CHANGED
@@ -1,13 +1,93 @@
1
- # Build Stage
2
- FROM node:20-slim AS build
3
- WORKDIR /app
4
- COPY package*.json ./
5
  RUN npm install
6
- COPY . .
 
7
  RUN npm run build
8
 
9
- # Production Stage
10
- FROM nginx:stable-alpine
11
- COPY --from=build /app/dist /usr/share/nginx/html
12
- EXPOSE 80
13
- CMD ["nginx", "-g", "daemon off;"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # --- Stage 1: Build Frontend ---
2
+ FROM node:20-slim AS frontend-builder
3
+ WORKDIR /app/frontend
4
+ COPY frontend/package*.json ./
5
  RUN npm install
6
+ COPY frontend/ ./
7
+ ENV VITE_API_URL=/api
8
  RUN npm run build
9
 
10
+ # --- Stage 2: Final Image ---
11
+ FROM node:20-slim
12
+
13
+ # Install system dependencies
14
+ # Includes dependencies for: Nginx and Puppeteer (for backend)
15
+ RUN apt-get update && apt-get install -y \
16
+ curl \
17
+ nginx \
18
+ python3 \
19
+ python3-pip \
20
+ wget \
21
+ gnupg \
22
+ ca-certificates \
23
+ procps \
24
+ libxss1 \
25
+ libasound2 \
26
+ libatk-bridge2.0-0 \
27
+ libatk1.0-0 \
28
+ libc6 \
29
+ libcairo2 \
30
+ libcups2 \
31
+ libdbus-1-3 \
32
+ libexpat1 \
33
+ libfontconfig1 \
34
+ libgbm1 \
35
+ libgcc1 \
36
+ libgconf-2-4 \
37
+ libgdk-pixbuf2.0-0 \
38
+ libglib2.0-0 \
39
+ libgtk-3-0 \
40
+ libnspr4 \
41
+ libnss3 \
42
+ libpango-1-0-0 \
43
+ libpangocairo-1.0-0 \
44
+ libstdc++6 \
45
+ libx11-6 \
46
+ libx11-xcb1 \
47
+ libxcb1 \
48
+ libxcomposite1 \
49
+ libxcursor1 \
50
+ libxdamage1 \
51
+ libxext6 \
52
+ libxfixes3 \
53
+ libxi6 \
54
+ libxrandr2 \
55
+ libxrender1 \
56
+ libxtst6 \
57
+ fonts-liberation \
58
+ libappindicator1 \
59
+ lsb-release \
60
+ xdg-utils \
61
+ ffmpeg \
62
+ --no-install-recommends \
63
+ && rm -rf /var/lib/apt/lists/*
64
+
65
+ WORKDIR /app
66
+
67
+ # Copy Backend and install dependencies
68
+ COPY backend/package*.json ./backend/
69
+ RUN cd backend && npm install
70
+
71
+ # Install minimal Python dependencies for scraping (if needed)
72
+ # We exclude the heavy XTTS/ML dependencies
73
+ COPY requirements.txt ./
74
+ RUN sed -i '/-r/d' requirements.txt && \
75
+ pip3 install --no-cache-dir --break-system-packages -r requirements.txt
76
+
77
+ # Copy all code
78
+ COPY . .
79
+
80
+ # Copy built frontend from Stage 1
81
+ COPY --from=frontend-builder /app/frontend/dist ./frontend/dist
82
+
83
+ # Setup Nginx
84
+ COPY nginx.conf /etc/nginx/nginx.conf
85
+
86
+ # Expose port 7860 for Hugging Face
87
+ EXPOSE 7860
88
+
89
+ # Ensure start.sh is executable
90
+ RUN chmod +x /app/start.sh
91
+
92
+ # Start all services via start.sh
93
+ CMD ["/app/start.sh"]
docker-compose.yml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ services:
2
+ # Backend Node.js Service
3
+ backend:
4
+ build:
5
+ context: ./backend
6
+ dockerfile: Dockerfile
7
+ ports:
8
+ - "5000:5000"
9
+ env_file:
10
+ - ./backend/.env
11
+ restart: always
12
+
13
+ # Frontend Vite Service
14
+ frontend:
15
+ build:
16
+ context: ./frontend
17
+ dockerfile: Dockerfile
18
+ ports:
19
+ - "3000:80"
20
+ depends_on:
21
+ - backend
22
+ restart: always
nginx.conf ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ worker_processes 1;
2
+
3
+ events {
4
+ worker_connections 1024;
5
+ }
6
+
7
+ http {
8
+ include /etc/nginx/mime.types;
9
+ default_type application/octet-stream;
10
+ sendfile on;
11
+ keepalive_timeout 65;
12
+
13
+ server {
14
+ listen 7860;
15
+
16
+ # Frontend Static Files
17
+ location / {
18
+ root /app/frontend/dist;
19
+ index index.html;
20
+ try_files $uri $uri/ /index.html;
21
+ }
22
+
23
+ # Backend API Proxy
24
+ location /api {
25
+ proxy_pass http://localhost:5000;
26
+ proxy_http_version 1.1;
27
+ proxy_set_header Upgrade $http_upgrade;
28
+ proxy_set_header Connection 'upgrade';
29
+ proxy_set_header Host $host;
30
+ proxy_cache_bypass $http_upgrade;
31
+ }
32
+ }
33
+ }
start.sh ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # Exit on error
4
+ set -e
5
+
6
+ echo "Starting services..."
7
+
8
+ # Start Node backend in the background
9
+ echo "Starting Node Backend..."
10
+ cd /app/backend
11
+ npm start &
12
+
13
+ # Start Nginx in the foreground
14
+ echo "Starting Nginx Reverse Proxy on port 7860..."
15
+ nginx -c /app/nginx.conf -g "daemon off;"