Files
test-alex-1/Dockerfile
Scaffolder a4edf15862
All checks were successful
Build and Push to ACR / Build and Push (push) Successful in 46s
initial commit
Change-Id: I15e0d095273278f8531caa7399565fe92857a7ad
2026-03-18 18:18:32 +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"]