From 50a023bc9a2cc356efb13f5b149b8ca271f03fb4 Mon Sep 17 00:00:00 2001 From: demo-bot Date: Thu, 7 May 2026 13:43:52 +0000 Subject: [PATCH] feat(scaffold): add Dockerfile [skip ci] --- Dockerfile | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ec570f1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +# ---- Build stage (install deps) ---- +FROM python:3.12-slim AS build +WORKDIR /app + +RUN pip install --upgrade pip +COPY requirements.txt . +RUN pip install --no-cache-dir --prefix=/install -r requirements.txt + +# ---- Runtime stage ---- +FROM python:3.12-slim +WORKDIR /app + +# Non-root user +RUN addgroup --system appgroup && adduser --system --ingroup appgroup appuser +USER appuser + +COPY --from=build /install /usr/local +COPY app/ ./app/ + +EXPOSE 8000 + +HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \ + CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1 + +CMD ["opentelemetry-instrument", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]