srivatsavdamaraju commited on
Commit
a33c10e
·
verified ·
1 Parent(s): 0b3b23a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +109 -74
Dockerfile CHANGED
@@ -1,74 +1,109 @@
1
- FROM python:3.10-slim
2
-
3
- # Set working directory
4
- WORKDIR /app
5
-
6
- # Install system dependencies
7
- RUN apt-get update && apt-get install -y \
8
- gcc \
9
- g++ \
10
- && rm -rf /var/lib/apt/lists/*
11
-
12
- # Copy requirements file
13
- COPY requirements.txt .
14
-
15
- # Install Python dependencies
16
- RUN pip install --no-cache-dir -r requirements.txt
17
-
18
- # Copy the application code
19
- COPY . .
20
-
21
- # Create all necessary directories with proper permissions
22
- RUN mkdir -p /app/tmp \
23
- /app/.config/matplotlib \
24
- /app/.cache \
25
- /app/.local && \
26
- chmod -R 777 /app/tmp /app/.config /app/.cache /app/.local
27
-
28
- # Set comprehensive environment variables
29
- ENV TMPDIR=/app/tmp \
30
- TEMP=/app/tmp \
31
- TMP=/app/tmp \
32
- MPLCONFIGDIR=/app/.config/matplotlib \
33
- XDG_CACHE_HOME=/app/.cache \
34
- XDG_CONFIG_HOME=/app/.config \
35
- HOME=/app \
36
- MPLBACKEND=Agg \
37
- PYTHONUNBUFFERED=1
38
-
39
- # Expose the port FastAPI will run on
40
- EXPOSE 7860
41
-
42
- # Command to run the FastAPI application
43
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1", "--timeout-keep-alive", "120"]
44
-
45
-
46
- # # Builder stage
47
- # FROM python:3.10-slim AS builder
48
- # WORKDIR /app
49
- # COPY requirements.txt .
50
- # RUN apt-get update && apt-get install -y gcc g++ \
51
- # && pip install --no-cache-dir -r requirements.txt \
52
- # && apt-get purge -y gcc g++ \
53
- # && apt-get autoremove -y \
54
- # && rm -rf /var/lib/apt/lists/*
55
-
56
- # # Runtime stage
57
- # FROM python:3.10-slim
58
- # WORKDIR /app
59
- # COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
60
- # COPY . .
61
- # # Create TMP directories
62
- # RUN mkdir -p /app/tmp /app/.config/matplotlib /app/.cache /app/.local && \
63
- # chmod -R 777 /app/tmp /app/.config /app/.cache /app/.local
64
- # ENV TMPDIR=/app/tmp \
65
- # TEMP=/app/tmp \
66
- # TMP=/app/tmp \
67
- # MPLCONFIGDIR=/app/.config/matplotlib \
68
- # XDG_CACHE_HOME=/app/.cache \
69
- # XDG_CONFIG_HOME=/app/.config \
70
- # HOME=/app \
71
- # MPLBACKEND=Agg \
72
- # PYTHONUNBUFFERED=1
73
- # EXPOSE 7860
74
- # CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1", "--timeout-keep-alive", "120"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FROM python:3.10-slim
2
+
3
+ # # Set working directory
4
+ # WORKDIR /app
5
+
6
+ # # Install system dependencies
7
+ # RUN apt-get update && apt-get install -y \
8
+ # gcc \
9
+ # g++ \
10
+ # && rm -rf /var/lib/apt/lists/*
11
+
12
+ # # Copy requirements file
13
+ # COPY requirements.txt .
14
+
15
+ # # Install Python dependencies
16
+ # RUN pip install --no-cache-dir -r requirements.txt
17
+
18
+ # # Copy the application code
19
+ # COPY . .
20
+
21
+ # # Create all necessary directories with proper permissions
22
+ # RUN mkdir -p /app/tmp \
23
+ # /app/.config/matplotlib \
24
+ # /app/.cache \
25
+ # /app/.local && \
26
+ # chmod -R 777 /app/tmp /app/.config /app/.cache /app/.local
27
+
28
+ # # Set comprehensive environment variables
29
+ # ENV TMPDIR=/app/tmp \
30
+ # TEMP=/app/tmp \
31
+ # TMP=/app/tmp \
32
+ # MPLCONFIGDIR=/app/.config/matplotlib \
33
+ # XDG_CACHE_HOME=/app/.cache \
34
+ # XDG_CONFIG_HOME=/app/.config \
35
+ # HOME=/app \
36
+ # MPLBACKEND=Agg \
37
+ # PYTHONUNBUFFERED=1
38
+
39
+ # # Expose the port FastAPI will run on
40
+ # EXPOSE 7860
41
+
42
+ # # Command to run the FastAPI application
43
+ # CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1", "--timeout-keep-alive", "120"]
44
+
45
+ FROM python:3.10-slim
46
+
47
+ # Set working directory
48
+ WORKDIR /app
49
+
50
+ # Install system + Playwright dependencies
51
+ RUN apt-get update && apt-get install -y \
52
+ gcc \
53
+ g++ \
54
+ wget \
55
+ curl \
56
+ gnupg \
57
+ libnss3 \
58
+ libdrm2 \
59
+ libxkbcommon0 \
60
+ libasound2 \
61
+ libatk1.0-0 \
62
+ libcups2 \
63
+ libdbus-1-3 \
64
+ libxcomposite1 \
65
+ libxdamage1 \
66
+ libxrandr2 \
67
+ libxshmfence1 \
68
+ libgbm1 \
69
+ libpango-1.0-0 \
70
+ libcairo2 \
71
+ libffi-dev \
72
+ && rm -rf /var/lib/apt/lists/*
73
+
74
+ # Copy requirements file
75
+ COPY requirements.txt .
76
+
77
+ # Install Python dependencies
78
+ RUN pip install --no-cache-dir -r requirements.txt
79
+
80
+ # Install Playwright browsers (Chromium only)
81
+ RUN playwright install chromium
82
+
83
+ # Copy your code
84
+ COPY . .
85
+
86
+ # Create needed directories
87
+ RUN mkdir -p /app/tmp \
88
+ /app/.config/matplotlib \
89
+ /app/.cache \
90
+ /app/.local && \
91
+ chmod -R 777 /app/tmp /app/.config /app/.cache /app/.local
92
+
93
+ # Environment variables
94
+ ENV TMPDIR=/app/tmp \
95
+ TEMP=/app/tmp \
96
+ TMP=/app/tmp \
97
+ MPLCONFIGDIR=/app/.config/matplotlib \
98
+ XDG_CACHE_HOME=/app/.cache \
99
+ XDG_CONFIG_HOME=/app/.config \
100
+ HOME=/app \
101
+ MPLBACKEND=Agg \
102
+ PYTHONUNBUFFERED=1
103
+
104
+ # Expose FastAPI port
105
+ EXPOSE 7860
106
+
107
+ # Start FastAPI
108
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1", "--timeout-keep-alive", "120"]
109
+