27 lines
633 B
Docker
27 lines
633 B
Docker
FROM python:3.12.15-slim-bookworm
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1
|
|
|
|
WORKDIR /app
|
|
|
|
RUN useradd --system --uid 10001 --no-create-home appuser
|
|
|
|
COPY requirements.txt .
|
|
RUN pip install -r requirements.txt
|
|
|
|
COPY alembic.ini ./
|
|
COPY migrations ./migrations
|
|
COPY app ./app
|
|
|
|
USER appuser
|
|
|
|
EXPOSE 8080
|
|
|
|
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD ["python", "-c", "import os, urllib.request; urllib.request.urlopen('http://127.0.0.1:' + os.environ['APP_PORT'] + '/health/live', timeout=2)"]
|
|
|
|
CMD ["python", "-m", "app"]
|