hello-api/Dockerfile

20 lines
685 B
Docker
Raw Permalink Normal View History

2026-09-16 16:26:15 +00:00
FROM python:3.12-slim
# Base image purana ho sakta hai. Security updates yahin lagao warna
# pipeline ka Trivy gate HIGH/CRITICAL par build rok dega.
RUN apt-get update && apt-get upgrade -y \
&& apt-get autoremove -y --purge \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /srv
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY app/ ./app/
ARG APP_VERSION=dev
ENV APP_VERSION=${APP_VERSION}
RUN useradd -r -u 1001 appuser
USER appuser
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=3s CMD python -c "import urllib.request;urllib.request.urlopen('http://127.0.0.1:8000/health')"
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "2", "app.main:app"]