Update Dockerfile
Browse files- Dockerfile +19 -4
Dockerfile
CHANGED
|
@@ -1,9 +1,23 @@
|
|
| 1 |
# Use the official Python image as base
|
| 2 |
-
FROM python:3.
|
|
|
|
| 3 |
|
| 4 |
# Install OS dependencies for Playwright and Chromium
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
-
wget gnupg curl unzip
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
# Set work directory
|
| 8 |
WORKDIR /app
|
| 9 |
|
|
@@ -15,10 +29,11 @@ RUN pip install --upgrade pip
|
|
| 15 |
RUN pip install fastapi uvicorn playwright nest_asyncio
|
| 16 |
|
| 17 |
# Install Playwright browsers (Chromium only)
|
|
|
|
| 18 |
RUN playwright install --with-deps chromium
|
| 19 |
|
| 20 |
# Expose the FastAPI port
|
| 21 |
-
|
| 22 |
|
| 23 |
# Command to run the FastAPI app
|
| 24 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "
|
|
|
|
| 1 |
# Use the official Python image as base
|
| 2 |
+
FROM python:3.9
|
| 3 |
+
|
| 4 |
|
| 5 |
# Install OS dependencies for Playwright and Chromium
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
+
wget gnupg curl unzip \
|
| 8 |
+
libnss3 libatk-bridge2.0-0 libgtk-3-0 \
|
| 9 |
+
libx11-xcb1 libxcomposite1 libxcursor1 libxdamage1 \
|
| 10 |
+
libxi6 libxtst6 libxrandr2 libcups2 libasound2 \
|
| 11 |
+
libpangocairo-1.0-0 libpango-1.0-0 libgbm1 \
|
| 12 |
+
libxshmfence1 libatspi2.0-0 \
|
| 13 |
+
&& apt-get clean \
|
| 14 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
RUN useradd -m -u 1000 user
|
| 18 |
+
USER user
|
| 19 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 20 |
+
|
| 21 |
# Set work directory
|
| 22 |
WORKDIR /app
|
| 23 |
|
|
|
|
| 29 |
RUN pip install fastapi uvicorn playwright nest_asyncio
|
| 30 |
|
| 31 |
# Install Playwright browsers (Chromium only)
|
| 32 |
+
RUN playwright install
|
| 33 |
RUN playwright install --with-deps chromium
|
| 34 |
|
| 35 |
# Expose the FastAPI port
|
| 36 |
+
COPY --chown=user . /app
|
| 37 |
|
| 38 |
# Command to run the FastAPI app
|
| 39 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|