-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (22 loc) · 948 Bytes
/
Copy pathDockerfile
File metadata and controls
31 lines (22 loc) · 948 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
FROM python:3.12-slim
# Install uv (fast package installer/resolver)
RUN pip install --no-cache-dir uv
WORKDIR /app
# Copy dependency manifests first so Docker can cache the install layer
COPY pyproject.toml uv.lock ./
# Install production deps into a virtualenv under /app/.venv
# --frozen: respect the lock exactly; --no-dev: skip test/lint tooling
RUN uv sync --frozen --no-dev
# Put the virtualenv on PATH so uvicorn is found at CMD time
ENV PATH="/app/.venv/bin:$PATH"
# Copy the rest of the project (see .dockerignore for exclusions)
COPY api/ api/
COPY controller/ controller/
COPY contracts/ contracts/
# Non-root user for container security
RUN useradd --no-create-home --shell /bin/false gcrah
USER gcrah
EXPOSE 8080
# Shell form so ${PORT:-8080} expands at runtime.
# --app-dir . ensures "api" resolves to our package, not a system one.
CMD ["sh", "-c", "uvicorn api.server:app --host 0.0.0.0 --port ${PORT:-8080} --app-dir ."]