forked from mtusi2026/mtusi2026lab6
24 lines
796 B
Docker
24 lines
796 B
Docker
FROM python:3.11.9-slim-bookworm
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=1
|
|
|
|
WORKDIR /app
|
|
RUN groupadd --system app && useradd --system --gid app --home-dir /app app
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
COPY app ./app
|
|
COPY migrations ./migrations
|
|
COPY scripts ./scripts
|
|
COPY tests ./tests
|
|
COPY contracts ./contracts
|
|
COPY lab.json .
|
|
COPY alembic.ini .
|
|
RUN chown -R app:app /app
|
|
USER app
|
|
EXPOSE 8080
|
|
HEALTHCHECK --interval=5s --timeout=3s --start-period=20s --retries=3 \
|
|
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready', timeout=2)"
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080", "--timeout-keep-alive", "5", "--timeout-graceful-shutdown", "20"]
|