feat: package and verify lab1 container lifecycle

This commit is contained in:
Самохвалов Андрей Ремович
2026-10-01 21:59:13 +03:00
parent 55ec45cc3d
commit c5e93067ec
8 changed files with 215 additions and 37 deletions
+18
View File
@@ -0,0 +1,18 @@
FROM python:3.12.12-slim-bookworm@sha256:593bd06efe90efa80dc4eee3948be7c0fde4134606dd40d8dd8dbcade98e669c
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
APP_HOST=0.0.0.0 \
APP_PORT=8080
WORKDIR /app
COPY requirements.lock .
RUN pip install --no-cache-dir -r requirements.lock \
&& groupadd --system app \
&& useradd --system --gid app --home-dir /app app
COPY src/ src/
USER app
EXPOSE 8080
HEALTHCHECK --interval=5s --timeout=3s --start-period=10s --retries=3 \
CMD python -c "import os, urllib.request; urllib.request.urlopen('http://127.0.0.1:' + os.environ['APP_PORT'] + '/health/ready', timeout=2)" || exit 1
CMD ["python", "-m", "src.server"]