mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-23 12:07:10 +00:00
35 lines
946 B
Docker
35 lines
946 B
Docker
# Stage 1: Install dependencies and compile staticfiles
|
|
FROM docker.io/python:3.13-alpine AS builder
|
|
|
|
COPY --from=ghcr.io/astral-sh/uv:0.4.30 /uv /uvx /bin/
|
|
|
|
WORKDIR /app
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PYTHONOPTIMIZE=2 \
|
|
UV_COMPILE_BYTECODE=1 \
|
|
UV_PROJECT_ENVIRONMENT=/opt/venv
|
|
|
|
COPY pyproject.toml .
|
|
|
|
RUN uv sync --no-dev --no-install-project --no-cache
|
|
|
|
COPY . .
|
|
|
|
RUN uv run python manage.py collectstatic --noinput
|
|
|
|
# Stage 2: Start nginx and serve staticfiles
|
|
FROM docker.io/nginx:1.28-alpine-slim
|
|
|
|
COPY --from=builder /app/static /usr/share/nginx/html
|
|
|
|
COPY ../checker/checker_requirements.txt /usr/share/nginx/html
|
|
|
|
RUN sed -i 's/worker_processes .*/worker_processes 1;/' /etc/nginx/nginx.conf
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --start-interval=2s --retries=3 \
|
|
CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:80/ || exit 1
|
|
|
|
CMD [ "nginx", "-g", "daemon off;" ]
|