forked from mtusi2026/mtusi2026lab5
Реализовать lab5 на оценку 4: async attachments, outbox, worker и variants.
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
||||
# Pinned base image (lab4 → lab5). Update digest when bumping Python.
|
||||
FROM python:3.12.8-slim-bookworm AS runtime
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
APP_HOST=0.0.0.0 \
|
||||
APP_PORT=8080 \
|
||||
PYTHONPATH=/app/src \
|
||||
MIGRATIONS_DIR=/app/migrations \
|
||||
UPLOAD_SPOOL_DIR=/tmp/messenger-spool
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN groupadd --system --gid 10001 app \
|
||||
&& useradd --system --uid 10001 --gid app --home /app --shell /usr/sbin/nologin app
|
||||
|
||||
# djpeg (libjpeg-turbo) verifies uploaded JPEGs; libwebp for optimized variants in the worker.
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
libjpeg-turbo-progs=1:2.1.5-2 \
|
||||
libwebp7=1.2.4-0.2+deb12u1 \
|
||||
libwebpdemux2=1.2.4-0.2+deb12u1 \
|
||||
libwebpmux3=1.2.4-0.2+deb12u1 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir --upgrade pip==24.3.1 \
|
||||
&& pip install --no-cache-dir --retries 10 --timeout 60 -r requirements.txt
|
||||
|
||||
# Code stays root-owned and read-only for the runtime user.
|
||||
COPY src ./src
|
||||
COPY migrations ./migrations
|
||||
|
||||
USER app
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
HEALTHCHECK --interval=5s --timeout=3s --start-period=15s --retries=5 \
|
||||
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health/ready', timeout=2)"
|
||||
|
||||
CMD ["python", "-m", "messenger"]
|
||||
Reference in New Issue
Block a user