-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile.backend
More file actions
47 lines (36 loc) · 1.7 KB
/
Dockerfile.backend
File metadata and controls
47 lines (36 loc) · 1.7 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
# ---------------------------------------------------------------------------
# Agent Economy — Backend Dockerfile
# Python 3.14 slim + uv for fast dependency installation
# ---------------------------------------------------------------------------
FROM python:3.14-slim
# Prevent Python from writing .pyc files and ensure stdout/stderr are unbuffered
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
APP_DIR=/app \
CONFIG_DIR=/app/config \
# Tell uv to use the system Python and install into system site-packages
UV_SYSTEM_PYTHON=1 \
UV_NO_CACHE=1
WORKDIR /app
# Install uv from the official image
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
# Install system dependencies needed by asyncpg (C compiler + libpq)
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq-dev \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Copy only the dependency manifests first (better layer caching —
# rebuilds only when dependencies change, not on every source change)
COPY backend/pyproject.toml backend/uv.lock* /app/backend/
# Install Python runtime dependencies into the system Python.
# Using uv sync from the project directory installs all declared deps.
RUN cd /app/backend && uv sync --no-install-project
# Copy application source (separate layer — only invalidated on code changes)
COPY backend/ /app/backend/
# Copy config directory
COPY config/ /app/config/
# Expose the application port
EXPOSE 8000
# Default command — overridden in docker-compose per service
# uv run ensures the project virtual env / system python with deps is used
CMD ["uv", "run", "--project", "/app/backend", "uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8000"]