forked from mtusi2026/mtusi2026lab2
Добавить Dockerfile и compose с PostgreSQL и Redis
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
FROM python:3.13.16-slim-bookworm
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PIP_NO_CACHE_DIR=1 \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=1
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# сначала зависимости: слой переиспользуется, пока не меняется requirements.txt
|
||||
COPY requirements.txt .
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
RUN groupadd --system --gid 10001 app \
|
||||
&& useradd --system --uid 10001 --gid app --no-create-home --shell /usr/sbin/nologin app
|
||||
|
||||
COPY src/ .
|
||||
COPY migrations/ migrations/
|
||||
|
||||
USER 10001:10001
|
||||
|
||||
ENV APP_HOST=0.0.0.0 \
|
||||
APP_PORT=8080 \
|
||||
APP_ENV=lab
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
HEALTHCHECK --interval=10s --timeout=5s --start-period=10s --retries=3 \
|
||||
CMD ["python", "healthcheck.py"]
|
||||
|
||||
STOPSIGNAL SIGTERM
|
||||
|
||||
# exec-форма: python запускается как PID 1 и сам получает SIGTERM
|
||||
CMD ["python", "main.py"]
|
||||
Reference in New Issue
Block a user