forked from mtusi2026/mtusi2026lab2
ЛР 2 — БПИ-2304 — Саламатин — на 4
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
FROM docker:28.5.1-cli AS docker_cli
|
||||
|
||||
FROM python:3.13.15-slim-bookworm AS runtime
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 \
|
||||
APP_HOST=0.0.0.0 APP_PORT=8080 APP_ENV=lab
|
||||
WORKDIR /app
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt \
|
||||
&& useradd --uid 10001 --create-home messenger
|
||||
COPY app ./app
|
||||
COPY migrations ./migrations
|
||||
COPY contracts/openapi.json ./contracts/openapi.json
|
||||
USER messenger
|
||||
EXPOSE 8080
|
||||
HEALTHCHECK --interval=5s --timeout=3s --start-period=10s --retries=5 \
|
||||
CMD python -c "import os, urllib.request; urllib.request.urlopen('http://127.0.0.1:' + os.getenv('APP_PORT', '8080') + '/health/ready', timeout=2)"
|
||||
CMD ["python", "-m", "app"]
|
||||
|
||||
# Optional test operator. The API image does not contain the Docker client/socket.
|
||||
FROM runtime AS checks
|
||||
USER root
|
||||
COPY --from=docker_cli /usr/local/bin/docker /usr/local/bin/docker
|
||||
COPY --from=docker_cli /usr/local/libexec/docker/cli-plugins/docker-compose /usr/local/libexec/docker/cli-plugins/docker-compose
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends make \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
WORKDIR /checks
|
||||
CMD ["make", "test-student"]
|
||||
Reference in New Issue
Block a user