Files
test-alex-gitops-1/Dockerfile
Scaffolder d10e2ce029
All checks were successful
Build and Push to ACR / Build and Push (push) Successful in 1m43s
initial commit
Change-Id: I3184ea3bc23ecc769c9de5fad0a0a0229e353629
2026-03-23 23:19:03 +00:00

26 lines
700 B
Docker

# ---- 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 ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]