Update Dockerfile
Browse files- Dockerfile +6 -4
Dockerfile
CHANGED
|
@@ -4,20 +4,22 @@ FROM python:3.12.1-slim-bookworm
|
|
| 4 |
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
|
| 5 |
|
| 6 |
# Install uv (the fast package manager)
|
|
|
|
| 7 |
RUN pip install uv
|
| 8 |
|
| 9 |
# Set the working directory
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
-
# Add the virtual environment’s bin directory to PATH so Python tools work globally
|
| 13 |
-
ENV PATH="/code/.venv/bin:$PATH"
|
| 14 |
-
|
| 15 |
# Copy dependency files
|
| 16 |
COPY pyproject.toml uv.lock ./
|
| 17 |
|
| 18 |
# Install dependencies from the lock file
|
| 19 |
RUN uv sync --frozen --no-cache
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
# Copy the FastAPI app and model
|
| 22 |
COPY predict.py model.bin ./
|
| 23 |
|
|
@@ -25,4 +27,4 @@ COPY predict.py model.bin ./
|
|
| 25 |
EXPOSE 9696
|
| 26 |
|
| 27 |
# Start the FastAPI app with uvicorn
|
| 28 |
-
ENTRYPOINT ["uvicorn", "predict:app", "--host", "0.0.0.0", "--port", "9696"]
|
|
|
|
| 4 |
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
|
| 5 |
|
| 6 |
# Install uv (the fast package manager)
|
| 7 |
+
# This step is technically redundant if the COPY above works, but we'll keep it.
|
| 8 |
RUN pip install uv
|
| 9 |
|
| 10 |
# Set the working directory
|
| 11 |
WORKDIR /app
|
| 12 |
|
|
|
|
|
|
|
|
|
|
| 13 |
# Copy dependency files
|
| 14 |
COPY pyproject.toml uv.lock ./
|
| 15 |
|
| 16 |
# Install dependencies from the lock file
|
| 17 |
RUN uv sync --frozen --no-cache
|
| 18 |
|
| 19 |
+
# The .venv is located inside the WORKDIR /app
|
| 20 |
+
ENV PATH="/app/.venv/bin:$PATH"
|
| 21 |
+
# ====================================
|
| 22 |
+
|
| 23 |
# Copy the FastAPI app and model
|
| 24 |
COPY predict.py model.bin ./
|
| 25 |
|
|
|
|
| 27 |
EXPOSE 9696
|
| 28 |
|
| 29 |
# Start the FastAPI app with uvicorn
|
| 30 |
+
ENTRYPOINT ["uvicorn", "predict:app", "--host", "0.0.0.0", "--port", "9696"]
|