| ARG BUILDPLATFORM |
| ARG TARGETPLATFORM |
| ARG TARGETARCH |
|
|
| FROM --platform=$BUILDPLATFORM node:22-alpine AS web-build |
|
|
| WORKDIR /app/web |
|
|
| COPY web/package.json web/bun.lock ./ |
| RUN npm install |
|
|
| COPY VERSION /app/VERSION |
| COPY web ./ |
| RUN NEXT_PUBLIC_APP_VERSION="$(cat /app/VERSION)" npm run build |
|
|
|
|
| FROM --platform=$TARGETPLATFORM python:3.13-slim AS app |
|
|
| ARG TARGETPLATFORM |
| ARG TARGETARCH |
|
|
| ENV PYTHONDONTWRITEBYTECODE=1 \ |
| PYTHONUNBUFFERED=1 \ |
| UV_LINK_MODE=copy |
| |
| WORKDIR /app |
|
|
| |
| |
| |
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| git \ |
| libpq-dev \ |
| gcc \ |
| openssl \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| RUN pip install --no-cache-dir uv |
|
|
| COPY pyproject.toml uv.lock ./ |
| RUN uv sync --frozen --no-dev --no-install-project |
|
|
| COPY main.py ./ |
| COPY VERSION ./ |
| COPY api ./api |
| COPY services ./services |
| COPY utils ./utils |
| COPY scripts ./scripts |
| COPY --from=web-build /app/web/out ./web_dist |
| RUN python - <<'PY' |
| from __future__ import annotations |
|
|
| import gzip |
| from pathlib import Path |
|
|
| root = Path("web_dist") |
| suffixes = {".css", ".html", ".js", ".json", ".map", ".svg", ".txt", ".xml"} |
| for path in root.rglob("*"): |
| if not path.is_file() or path.suffix.lower() not in suffixes or path.stat().st_size < 1024: |
| continue |
| gz_path = path.with_name(f"{path.name}.gz") |
| with path.open("rb") as source, gzip.open(gz_path, "wb", compresslevel=9) as target: |
| target.writelines(source) |
| PY |
|
|
| EXPOSE 7860 |
|
|
| CMD ["uv", "run", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--access-log"] |
|
|