-
Notifications
You must be signed in to change notification settings - Fork 116
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (27 loc) · 1.38 KB
/
Dockerfile
File metadata and controls
38 lines (27 loc) · 1.38 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
# ------------------- Stage 1: Build Stage ------------------------------
# We use Alpine for smaller image size (~329MB vs ~431MB for Debian slim).
# Trade-off: We must install build tools to compile native extensions (cryptography, etc.)
# since pre-built musl wheels aren't available. Debian -slim would skip compilation
# but produces a larger final image due to glibc wheel sizes.
FROM python:3.13-alpine AS build
# Install build dependencies for packages with native extensions (cryptography, etc.)
# https://cryptography.io/en/latest/installation/#building-cryptography-on-linux
RUN apk add --no-cache gcc g++ musl-dev python3-dev libffi-dev openssl-dev cargo pkgconfig
COPY --from=ghcr.io/astral-sh/uv:0.9.14 /uv /uvx /bin/
WORKDIR /code
# Copy dependency files and install dependencies (for layer caching)
# Note: We can't use --mount=type=cache since Azure Container Apps remote build doesn't support BuildKit:
# https://github.com/Azure/acr/issues/721
COPY uv.lock pyproject.toml ./
RUN uv sync --locked --no-install-project
# Copy the project and sync
COPY . .
RUN uv sync --locked
# ------------------- Stage 2: Final Stage ------------------------------
FROM python:3.13-alpine AS final
RUN addgroup -S app && adduser -S app -G app
COPY --from=build --chown=app:app /code /code
WORKDIR /code/agents
USER app
ENV PATH="/code/.venv/bin:$PATH"
ENTRYPOINT ["python", "agentframework_http.py"]