Update Dockerfile
Browse files- Dockerfile +19 -23
Dockerfile
CHANGED
|
@@ -1,20 +1,24 @@
|
|
| 1 |
-
# 1. Use the FULL image to get all build tools by default
|
| 2 |
FROM python:3.11
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
git \
|
| 9 |
-
libnss3 \
|
| 10 |
-
libxss1 \
|
| 11 |
-
libasound2 \
|
| 12 |
-
libatk-bridge2.0-0 \
|
| 13 |
-
libgtk-3-0 \
|
| 14 |
-
libgbm1 \
|
| 15 |
&& rm -rf /var/lib/apt/lists/*
|
| 16 |
|
| 17 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
RUN useradd -m -u 1000 user
|
| 19 |
USER user
|
| 20 |
ENV HOME=/home/user \
|
|
@@ -22,17 +26,9 @@ ENV HOME=/home/user \
|
|
| 22 |
PYTHONUNBUFFERED=1
|
| 23 |
|
| 24 |
WORKDIR $HOME/app
|
| 25 |
-
RUN mkdir -p $HOME/app/static
|
| 26 |
-
COPY --chown=user requirements.txt .
|
| 27 |
-
|
| 28 |
-
# 4. Install Python stack with latest build tools
|
| 29 |
-
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
|
| 30 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 31 |
-
|
| 32 |
-
# 5. Setup Playwright for the take_screenshot tool
|
| 33 |
-
RUN playwright install chromium
|
| 34 |
-
RUN playwright install-deps chromium
|
| 35 |
|
|
|
|
| 36 |
COPY --chown=user . .
|
| 37 |
|
| 38 |
EXPOSE 7860
|
|
|
|
|
|
|
| 1 |
FROM python:3.11
|
| 2 |
|
| 3 |
+
# 1. Stay as ROOT to install all heavy system dependencies
|
| 4 |
+
USER root
|
| 5 |
+
|
| 6 |
+
RUN apt-get update && apt-get install -y \
|
| 7 |
+
wget curl git build-essential \
|
| 8 |
+
libnss3 libxss1 libasound2 libatk-bridge2.0-0 libgtk-3-0 libgbm1 \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
+
# 2. Upgrade pip to the absolute latest version
|
| 12 |
+
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
|
| 13 |
+
|
| 14 |
+
# 3. Install Python packages DIRECTLY (Bypassing requirements.txt to avoid version clashes)
|
| 15 |
+
RUN pip install --no-cache-dir fastapi uvicorn python-dotenv aiofiles litellm playwright openclaw
|
| 16 |
+
|
| 17 |
+
# 4. Install Playwright OS dependencies AS ROOT (This fixes the hidden crash)
|
| 18 |
+
RUN playwright install chromium
|
| 19 |
+
RUN playwright install-deps chromium
|
| 20 |
+
|
| 21 |
+
# 5. Now that everything is installed, switch to the required Hugging Face user
|
| 22 |
RUN useradd -m -u 1000 user
|
| 23 |
USER user
|
| 24 |
ENV HOME=/home/user \
|
|
|
|
| 26 |
PYTHONUNBUFFERED=1
|
| 27 |
|
| 28 |
WORKDIR $HOME/app
|
| 29 |
+
RUN mkdir -p $HOME/app/static
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
+
# 6. Copy the Python code and give ownership to the user
|
| 32 |
COPY --chown=user . .
|
| 33 |
|
| 34 |
EXPOSE 7860
|