initial commit
Some checks failed
CI / Run tests (push) Has been cancelled
CI / Docker build test (push) Has been cancelled
CI / Lint (ruff + mypy) (push) Has been cancelled

This commit is contained in:
2026-03-30 16:46:26 +07:00
commit 2a7dfa95c8
67 changed files with 5864 additions and 0 deletions

55
Dockerfile Normal file
View File

@@ -0,0 +1,55 @@
# syntax=docker/dockerfile:1.7
FROM python:3.13-slim AS builder
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
UV_LINK_MODE=copy
WORKDIR /app
COPY --from=ghcr.io/astral-sh/uv:0.10.8 /uv /uvx /bin/
COPY pyproject.toml README.md ./
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --no-dev --no-install-project
COPY src ./src
COPY migrations ./migrations
COPY alembic.ini ./
COPY scripts ./scripts
COPY .env.example ./
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --no-dev
FROM python:3.13-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PATH="/app/.venv/bin:$PATH" \
PYTHONPATH="/app/src"
WORKDIR /app
RUN groupadd -g 1000 app \
&& useradd -u 1000 -g app -m -s /usr/sbin/nologin app
COPY --from=builder /app/.venv /app/.venv
COPY --chown=app:app src ./src
COPY --chown=app:app migrations ./migrations
COPY --chown=app:app alembic.ini ./
COPY --chown=app:app scripts ./scripts
COPY --chown=app:app .env.example ./
COPY --chown=app:app README.md ./
COPY --chown=app:app pyproject.toml ./
RUN chmod +x /app/scripts/start.sh /app/scripts/run_migration.sh \
&& chown -R app:app /app
USER app
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
CMD python -c "import os, urllib.request; urllib.request.urlopen(f\"http://127.0.0.1:{os.getenv('API_PORT', '8080')}/health\")"
CMD ["/app/scripts/start.sh"]