-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (30 loc) · 1.04 KB
/
Dockerfile
File metadata and controls
45 lines (30 loc) · 1.04 KB
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
38
39
40
41
42
43
44
45
# Base image for building the virtual environment
FROM python:3.13-bookworm AS builder
ENV PATH="/root/.cargo/bin:$PATH" \
UV_INDEX_URL="https://mirrors.cernet.edu.cn/pypi/web/simple" \
PIP_INDEX_URL="https://mirrors.cernet.edu.cn/pypi/web/simple"
# Install uv and tools
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
WORKDIR /app
COPY pyproject.toml .
# Create and install dependencies in the virtual environment
RUN uv sync
# Separate stage for validation (build and test)
FROM builder AS validator
WORKDIR /app
COPY . .
# Run build and test as part of the validation
RUN make build && make test
# Final image for running the application
FROM python:3.13-slim-bookworm
LABEL author="Mystic"
ENV PATH="/app/.venv/bin:$PATH" \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
# Copy the virtual environment and application code
COPY --from=builder /app/.venv /app/.venv
COPY src ./src
EXPOSE 8000
# Use uvicorn for production serving
CMD ["uvicorn", "src.llm.serving.api:app", "--host", "0.0.0.0", "--port", "8000"]