-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile
30 lines (22 loc) · 875 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Use an appropriate base image
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
# Install the project into `/app`
WORKDIR /app
# Set environment variables (e.g., set Python to run in unbuffered mode)
ENV PYTHONUNBUFFERED 1
# Install system dependencies for building libraries
RUN apt-get update && apt-get install -y \
build-essential \
g++ \
&& rm -rf /var/lib/apt/lists/*
# Copy the dependency management files (lock file and pyproject.toml) first
COPY uv.lock pyproject.toml /app/
# Install the application dependencies
RUN uv sync --frozen --no-cache
# Copy your application code into the container
COPY src/ /app/
# Set the virtual environment environment variables
ENV VIRTUAL_ENV=/app/.venv \
PATH="/app/.venv/bin:$PATH"
# Run the FastAPI app using uvicorn
CMD ["uvicorn", "interfaces.fastapi_app:app", "--host", "0.0.0.0", "--port", "8000"]