Maouu commited on
Commit
313d9bb
·
verified ·
1 Parent(s): b653db2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -8
Dockerfile CHANGED
@@ -1,37 +1,44 @@
1
  FROM python:3.9-slim
2
 
3
- # System dependencies
4
  RUN apt-get update && apt-get install -y --no-install-recommends \
5
  build-essential gcc libffi-dev libpq-dev curl gnupg ca-certificates && \
6
  apt-get clean && rm -rf /var/lib/apt/lists/*
7
 
8
  # ---------- Install Node.js ----------
9
- # Add NodeSource APT repo
10
  RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
11
  apt-get install -y nodejs && \
12
  node -v && npm -v
13
 
14
- # ---------- Python Setup ----------
15
  WORKDIR /app
 
 
16
  COPY requirements.txt .
17
  RUN pip install --no-cache-dir --upgrade pip && \
18
  pip install --no-cache-dir -r requirements.txt
19
 
20
- # ---------- Node.js Setup ----------
21
- # Copy JS files (adjust if needed)
22
  COPY test.js ./
23
  RUN npm install youtube-po-token-generator
24
 
25
- # ---------- Logging and User Setup ----------
 
 
 
26
  RUN touch logs.json && \
27
  chown 1000:1000 logs.json && \
28
  chmod 664 logs.json
29
 
 
30
  RUN useradd -m -u 1000 user
31
  USER user
 
 
32
  ENV PATH="/home/user/.local/bin:$PATH"
33
 
 
34
  EXPOSE 7860
35
 
36
- # ---------- Run Uvicorn ----------
37
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "2"]
 
1
  FROM python:3.9-slim
2
 
3
+ # ---------- System dependencies ----------
4
  RUN apt-get update && apt-get install -y --no-install-recommends \
5
  build-essential gcc libffi-dev libpq-dev curl gnupg ca-certificates && \
6
  apt-get clean && rm -rf /var/lib/apt/lists/*
7
 
8
  # ---------- Install Node.js ----------
 
9
  RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
10
  apt-get install -y nodejs && \
11
  node -v && npm -v
12
 
13
+ # ---------- Set working directory ----------
14
  WORKDIR /app
15
+
16
+ # ---------- Python dependencies ----------
17
  COPY requirements.txt .
18
  RUN pip install --no-cache-dir --upgrade pip && \
19
  pip install --no-cache-dir -r requirements.txt
20
 
21
+ # ---------- Node.js setup ----------
 
22
  COPY test.js ./
23
  RUN npm install youtube-po-token-generator
24
 
25
+ # ---------- App code ----------
26
+ COPY . .
27
+
28
+ # ---------- Logging and permissions ----------
29
  RUN touch logs.json && \
30
  chown 1000:1000 logs.json && \
31
  chmod 664 logs.json
32
 
33
+ # ---------- Create non-root user ----------
34
  RUN useradd -m -u 1000 user
35
  USER user
36
+
37
+ # ---------- Environment ----------
38
  ENV PATH="/home/user/.local/bin:$PATH"
39
 
40
+ # ---------- Expose default Hugging Face Spaces port ----------
41
  EXPOSE 7860
42
 
43
+ # ---------- Start FastAPI with uvicorn ----------
44
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]