forked from mtusi2026/mtusi2026lab5
30 lines
720 B
Docker
30 lines
720 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
|
|
|
|
ARG API_BUILD_REVISION
|
|
LABEL org.opencontainers.image.revision=$API_BUILD_REVISION
|
|
|
|
USER appuser
|
|
|
|
EXPOSE 8080
|
|
|
|
HEALTHCHECK --interval=3s --timeout=3s --start-period=10s --retries=2 \
|
|
CMD ["python", "-c", "import os, urllib.request; urllib.request.urlopen('http://127.0.0.1:' + os.environ['APP_PORT'] + '/health/ready', timeout=2.5)"]
|
|
|
|
CMD ["python", "-m", "app"]
|