ABDALLALSWAITI commited on
Commit
656ea8a
·
verified ·
1 Parent(s): f9f8ffb

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +26 -17
Dockerfile CHANGED
@@ -1,11 +1,22 @@
1
- FROM python:3.13.5-slim
2
 
3
  WORKDIR /app
4
 
5
- # Install Node.js and Chromium
6
  RUN apt-get update && apt-get install -y \
7
  curl \
 
 
 
 
 
 
 
 
 
 
8
  chromium \
 
9
  fonts-liberation \
10
  libasound2 \
11
  libatk-bridge2.0-0 \
@@ -23,31 +34,29 @@ RUN apt-get update && apt-get install -y \
23
  libxkbcommon0 \
24
  libxrandr2 \
25
  xdg-utils \
26
- ca-certificates \
27
- fonts-freefont-ttf \
28
- && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
29
- && apt-get install -y nodejs \
30
  && rm -rf /var/lib/apt/lists/*
31
 
32
- # Copy package files
33
- COPY requirements.txt package.json ./
 
34
 
35
- # Install dependencies
36
- RUN pip3 install --no-cache-dir -r requirements.txt
37
  RUN npm install
38
 
39
  # Copy application files
40
  COPY app.py puppeteer_pdf.js ./
 
 
 
 
41
 
42
- # Set environment variables
43
  ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
44
  ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
 
45
 
46
- # Expose port 7860 (Hugging Face default)
47
  EXPOSE 7860
48
 
49
- # Health check
50
- HEALTHCHECK CMD curl --fail http://localhost:7860/health || exit 1
51
-
52
- # Run FastAPI app
53
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ FROM python:3.11-slim
2
 
3
  WORKDIR /app
4
 
5
+ # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
  curl \
8
+ wget \
9
+ gnupg \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Install Node.js 20
13
+ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
14
+ && apt-get install -y nodejs
15
+
16
+ # Install Chromium dependencies
17
+ RUN apt-get update && apt-get install -y \
18
  chromium \
19
+ chromium-sandbox \
20
  fonts-liberation \
21
  libasound2 \
22
  libatk-bridge2.0-0 \
 
34
  libxkbcommon0 \
35
  libxrandr2 \
36
  xdg-utils \
 
 
 
 
37
  && rm -rf /var/lib/apt/lists/*
38
 
39
+ # Copy and install Python dependencies
40
+ COPY requirements.txt .
41
+ RUN pip install --no-cache-dir -r requirements.txt
42
 
43
+ # Copy and install Node dependencies
44
+ COPY package.json .
45
  RUN npm install
46
 
47
  # Copy application files
48
  COPY app.py puppeteer_pdf.js ./
49
+ RUN chmod +x puppeteer_pdf.js
50
+
51
+ # Create temp directory
52
+ RUN mkdir -p /tmp && chmod 777 /tmp
53
 
54
+ # Environment variables
55
  ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
56
  ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
57
+ ENV PORT=7860
58
 
 
59
  EXPOSE 7860
60
 
61
+ # Start command
62
+ CMD uvicorn app:app --host 0.0.0.0 --port 7860 --timeout-keep-alive 120