Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +2 -12
Dockerfile
CHANGED
|
@@ -7,8 +7,6 @@ FROM python:3.11-slim
|
|
| 7 |
WORKDIR /app
|
| 8 |
|
| 9 |
# 1. Install System-Level Dependencies
|
| 10 |
-
# We need Git (good practice), and Java for the tabula-py library.
|
| 11 |
-
# We also add 'curl' and 'unzip' which can be useful system tools.
|
| 12 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 13 |
curl \
|
| 14 |
unzip \
|
|
@@ -18,29 +16,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 18 |
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
|
| 20 |
# 2. Install 'uv', the fast Python package manager
|
| 21 |
-
# This makes the subsequent dependency installation much faster.
|
| 22 |
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
|
| 23 |
-
ENV PATH="/root/.cargo/bin:${PATH}"
|
| 24 |
|
| 25 |
# 3. Install Python Dependencies using 'uv'
|
| 26 |
-
# Copy requirements file first to leverage Docker layer caching
|
| 27 |
COPY requirements.txt .
|
| 28 |
-
# Use
|
| 29 |
-
RUN uv pip install --no-cache-dir -r requirements.txt
|
| 30 |
|
| 31 |
# 4. Install Playwright Browsers
|
| 32 |
-
# This command installs the necessary browsers for the scrape_dynamic_site tool
|
| 33 |
RUN playwright install
|
| 34 |
|
| 35 |
# 5. Copy Your Application Code
|
| 36 |
-
# Copy main.py, tools.py, etc., into the container's /app directory
|
| 37 |
COPY . .
|
| 38 |
|
| 39 |
# 6. Expose the Port
|
| 40 |
-
# Tell Docker that the container will listen on port 8000
|
| 41 |
EXPOSE 8000
|
| 42 |
|
| 43 |
# 7. Define the Startup Command
|
| 44 |
-
# This command runs your FastAPI server. The --host 0.0.0.0 is ESSENTIAL.
|
| 45 |
-
# We use 'uvicorn' here as 'uv' does not yet have a stable application server.
|
| 46 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
|
| 7 |
WORKDIR /app
|
| 8 |
|
| 9 |
# 1. Install System-Level Dependencies
|
|
|
|
|
|
|
| 10 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 11 |
curl \
|
| 12 |
unzip \
|
|
|
|
| 16 |
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
|
| 18 |
# 2. Install 'uv', the fast Python package manager
|
|
|
|
| 19 |
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
|
|
| 20 |
|
| 21 |
# 3. Install Python Dependencies using 'uv'
|
|
|
|
| 22 |
COPY requirements.txt .
|
| 23 |
+
# Use the full path to the 'uv' executable
|
| 24 |
+
RUN /root/.local/bin/uv pip install --no-cache-dir -r requirements.txt
|
| 25 |
|
| 26 |
# 4. Install Playwright Browsers
|
|
|
|
| 27 |
RUN playwright install
|
| 28 |
|
| 29 |
# 5. Copy Your Application Code
|
|
|
|
| 30 |
COPY . .
|
| 31 |
|
| 32 |
# 6. Expose the Port
|
|
|
|
| 33 |
EXPOSE 8000
|
| 34 |
|
| 35 |
# 7. Define the Startup Command
|
|
|
|
|
|
|
| 36 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|