-
Notifications
You must be signed in to change notification settings - Fork 697
Expand file tree
/
Copy pathDockerfile
More file actions
57 lines (43 loc) · 1.39 KB
/
Dockerfile
File metadata and controls
57 lines (43 loc) · 1.39 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
46
47
48
49
50
51
52
53
54
55
56
57
# Build stage
FROM python:3.13-slim AS builder
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# Install build dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# Copy dependency files first for better caching
COPY pyproject.toml uv.lock ./
# Install dependencies with app group (excludes dev-only tools like pytest, ruff)
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked --group app --no-install-project
# Copy the rest of the project
COPY . .
# Install the project itself
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked --group app
# Runtime stage
FROM python:3.13-slim AS runtime
# Install runtime dependencies only
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libpq5 \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# Copy virtual environment from builder
COPY --from=builder /app/.venv /app/.venv
# Copy application code
COPY --from=builder /app/intentkit /app/intentkit
COPY --from=builder /app/app /app/app
COPY --from=builder /app/scripts /app/scripts
ARG RELEASE=local
ENV RELEASE=$RELEASE
ENV PATH="/app/.venv/bin:$PATH"
# Command to run the application
CMD ["uvicorn", "app.api:app", "--host", "0.0.0.0", "--port", "80"]