-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (27 loc) · 954 Bytes
/
Dockerfile
File metadata and controls
37 lines (27 loc) · 954 Bytes
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
31
32
33
34
35
36
37
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
# libgomp1 is needed for some ML libraries
RUN apt-get update && apt-get install -y \
build-essential \
curl \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Install uv for fast package management
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
# Copy dependency files
COPY pyproject.toml uv.lock ./
# Install dependencies
# We use --system to install into the system python, avoiding venv complexity in container
RUN uv sync --frozen --no-dev
# Copy application code
COPY . .
# Create directory for ML artifacts
RUN mkdir -p app/models/artifacts
# Expose port
EXPOSE 8000
# Run the application
# We use the python directly from the .venv created by uv sync, or just rely on system path if we used --system
# uv sync creates a .venv by default. Let's use it.
ENV PATH="/app/.venv/bin:$PATH"
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]