Files
mtusi2026lab5/Dockerfile
T

32 lines
1.1 KiB
Docker

FROM python:3.11.13-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir --only-binary=:all: -r requirements.txt
COPY main.py settings.py errors.py db.py auth.py migrate.py storage.py uploads.py attachments.py janitor.py s3_init.py \
pipeline.py broker.py dispatcher.py worker.py imaging.py faults.py ops.py ./
COPY migrations/ ./migrations/
RUN useradd --create-home --shell /usr/sbin/nologin appuser \
&& mkdir -p /faults && chown appuser:appuser /faults
# /faults — точка монтирования volume faults (учебное внедрение сбоев worker/dispatcher); владелец appuser
# копируется в пустой named volume при первом монтировании.
USER appuser
ARG APP_VERSION=dev
ENV APP_VERSION=${APP_VERSION}
EXPOSE 8080
HEALTHCHECK --interval=10s --timeout=5s --start-period=20s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready', timeout=4)"
CMD ["python", "main.py"]