forked from postmanlabs/httpbin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (27 loc) · 1.16 KB
/
Dockerfile
File metadata and controls
32 lines (27 loc) · 1.16 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
FROM python:3.14.2-slim@sha256:1a3c6dbfd2173971abba880c3cc2ec4643690901f6ad6742d0827bae6cefc925 AS base
LABEL org.opencontainers.image.name=europe-west3-docker.pkg.dev/zeitonline-engineering/docker-zon/httpbin
COPY --from=ghcr.io/astral-sh/uv:0.9.27@sha256:143b40f4ab56a780f43377604702107b5a35f83a4453daf1e4be691358718a6a /uv /usr/bin/
ENV UV_NO_MANAGED_PYTHON=1 \
UV_NO_CACHE=1 \
UV_COMPILE_BYTECODE=1 \
UV_FROZEN=1 \
UV_INDEX_PYPI_ZON_USERNAME="oauth2accesstoken"
WORKDIR /app
RUN groupadd --gid=10000 app && \
useradd --uid=10000 --gid=app --no-user-group \
--create-home --home-dir /app app && \
chown -R app:app /app
USER app
RUN uv venv --allow-existing /app
ENV PATH=/app/bin:$PATH \
UV_PROJECT_ENVIRONMENT=/app
COPY pyproject.toml uv.lock ./
COPY httpbin httpbin
RUN --mount=type=secret,id=GCLOUD_TOKEN,env=UV_INDEX_PYPI_ZON_PASSWORD \
uv sync --group deploy
ENTRYPOINT ["python", "-m", "gunicorn", "-b", "0.0.0.0:8080", "httpbin:app", "-k", "gevent"]
# Security updates run last, to intentionally bust the docker cache.
USER root
RUN apt-get update && apt-get -y upgrade && \
apt-get clean && rm -rf /var/lib/apt/lists/*
USER app