Update Dockerfile
Browse files- Dockerfile +47 -16
Dockerfile
CHANGED
|
@@ -1,22 +1,53 @@
|
|
| 1 |
-
# Use
|
| 2 |
-
FROM python:3.
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
RUN apt-get update && apt-get install -y \
|
| 6 |
-
wget gnupg curl unzip
|
| 7 |
-
|
| 8 |
-
# Set work directory
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
-
#
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
|
| 16 |
-
RUN pip install fastapi uvicorn playwright nest_asyncio
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
|
| 20 |
|
| 21 |
-
|
| 22 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "
|
|
|
|
| 1 |
+
# Use Python 3.9 as the base image
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
|
| 4 |
+
# Set working directory
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Install system dependencies required for Playwright
|
| 8 |
+
RUN apt-get update && apt-get install -y \
|
| 9 |
+
wget \
|
| 10 |
+
gnupg \
|
| 11 |
+
ca-certificates \
|
| 12 |
+
fonts-liberation \
|
| 13 |
+
libasound2 \
|
| 14 |
+
libatk-bridge2.0-0 \
|
| 15 |
+
libatk1.0-0 \
|
| 16 |
+
libatspi2.0-0 \
|
| 17 |
+
libcairo2 \
|
| 18 |
+
libcups2 \
|
| 19 |
+
libdbus-1-3 \
|
| 20 |
+
libdrm2 \
|
| 21 |
+
libgbm1 \
|
| 22 |
+
libglib2.0-0 \
|
| 23 |
+
libnspr4 \
|
| 24 |
+
libnss3 \
|
| 25 |
+
libpango-1.0-0 \
|
| 26 |
+
libx11-6 \
|
| 27 |
+
libxcb1 \
|
| 28 |
+
libxcomposite1 \
|
| 29 |
+
libxdamage1 \
|
| 30 |
+
libxext6 \
|
| 31 |
+
libxfixes3 \
|
| 32 |
+
libxkbcommon0 \
|
| 33 |
+
libxrandr2 \
|
| 34 |
+
xvfb \
|
| 35 |
+
--no-install-recommends \
|
| 36 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 37 |
+
|
| 38 |
+
# Copy requirements file and install Python dependencies
|
| 39 |
+
COPY requirements.txt .
|
| 40 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 41 |
+
|
| 42 |
+
# Install Playwright and browsers
|
| 43 |
+
RUN playwright install-deps chromium
|
| 44 |
+
RUN playwright install chromium
|
| 45 |
|
| 46 |
+
# Copy the application code
|
| 47 |
+
COPY app.py .
|
|
|
|
| 48 |
|
| 49 |
+
# Expose the port the app runs on
|
| 50 |
+
EXPOSE 8000
|
| 51 |
|
| 52 |
+
# Command to run the application with xvfb for headless browser support
|
| 53 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|