-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
62 lines (47 loc) · 1.5 KB
/
Dockerfile
File metadata and controls
62 lines (47 loc) · 1.5 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
58
59
60
61
62
# Multi-stage build for api-server
# Stage 1: Build the package
FROM python:3.14 AS builder
WORKDIR /app
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# Install uv and build dependencies
RUN pip install --no-cache-dir uv
# Copy source files
COPY src/ /app/src/
COPY pyproject.toml /app/
# Build the package
RUN uv pip install --system --no-cache-dir setuptools
RUN uv pip install --system --no-cache-dir --no-build-isolation -e .
RUN pip install --no-cache-dir build
RUN python -m build
# Stage 2: Runtime image
FROM python:3.14-slim
LABEL org.opencontainers.image.title="api-server"
WORKDIR /app
# Install runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq5 \
procps \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy and install built package
COPY --from=builder /app/dist /app/dist
RUN pip install --no-cache-dir /app/dist/*.whl
# Copy configuration files
COPY migrations /app/migrations
COPY alembic.ini /app/alembic.ini
EXPOSE 8080
# Set environment variables
ENV API_SERVER_HOST=0.0.0.0
ENV API_SERVER_PORT=8080
ENV API_SERVER_LOG_LEVEL=INFO
# Required environment variables (must be set at runtime):
# API_SERVER_DATABASE_URL - Database connection URL
#
# Optional environment variables:
# API_SERVER_LOG_LEVEL - Log level (default: INFO)
# API_SERVER_PROFILES - Server profiles (rest, graphql)
CMD ["api-server", "run", "--no-reload"]