mirror of
http://88.130.71.182:3000/BlitTech/deals24togo_be.git
synced 2026-06-12 23:33:21 +00:00
36 lines
872 B
Docker
36 lines
872 B
Docker
FROM python:3.12-slim AS base
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=1
|
|
|
|
WORKDIR /app
|
|
|
|
# System dependencies
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
libjpeg-dev \
|
|
zlib1g-dev && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Python dependencies
|
|
COPY requirements.txt .
|
|
RUN pip install --upgrade pip && \
|
|
pip install -r requirements.txt
|
|
|
|
# Application code
|
|
COPY . .
|
|
|
|
# Non-root user
|
|
RUN adduser --disabled-password --gecos '' appuser && \
|
|
chown -R appuser:appuser /app
|
|
USER appuser
|
|
|
|
EXPOSE 8000
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
|
|
CMD python -c "import httpx; r = httpx.get('http://localhost:8000/health'); r.raise_for_status()"
|
|
|
|
CMD ["uvicorn", "app.main:create_app", "--factory", "--host", "0.0.0.0", "--port", "8000", "--workers", "4"]
|