diff --git a/Dockerfile b/Dockerfile index e9ef483..87745c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,11 +2,12 @@ # # Build: # docker build \ -# --build-context issue-core=/home/worsch/issue-core \ +# --secret id=gitea_pypi_user,env=GITEA_PYPI_USER \ +# --secret id=gitea_pypi_password,env=GITEA_PYPI_TOKEN \ # -t gitea.coulomb.social/coulomb/vergabe-teilnahme: . # -# The `issue-core` named context is required because pyproject.toml has -# a path dependency on a sibling repo; uv.lock pins it as "../issue-core". +# The optional secrets let uv authenticate to the Gitea Python package +# registry when resolving issue-core. # ─── Stage 1 ─── Vite + Tailwind asset build ──────────────────────────────── @@ -38,10 +39,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ COPY --from=ghcr.io/astral-sh/uv:0.5.11 /uv /usr/local/bin/uv -COPY --from=issue-core . /issue-core/ WORKDIR /app COPY pyproject.toml uv.lock ./ -RUN uv sync --frozen --no-dev --no-install-project +RUN --mount=type=secret,id=gitea_pypi_user,required=false \ + --mount=type=secret,id=gitea_pypi_password,required=false \ + sh -eu -c '\ + if [ -f /run/secrets/gitea_pypi_user ]; then \ + export UV_INDEX_GITEA_USERNAME="$(cat /run/secrets/gitea_pypi_user)"; \ + fi; \ + if [ -f /run/secrets/gitea_pypi_password ]; then \ + export UV_INDEX_GITEA_PASSWORD="$(cat /run/secrets/gitea_pypi_password)"; \ + fi; \ + uv sync --no-dev --no-install-project \ + ' # ─── Stage 3 ─── Runtime image ────────────────────────────────────────────── @@ -60,7 +70,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ WORKDIR /app -COPY --from=python-deps /issue-core /issue-core COPY --from=python-deps /app/.venv ./.venv COPY --chown=app:app manage.py pyproject.toml ./ diff --git a/pyproject.toml b/pyproject.toml index a38ea68..2452537 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,10 +10,18 @@ dependencies = [ "whitenoise>=6.7", "python-decouple>=3.8", "dj-database-url>=2.1", - "issue-core @ file:///home/worsch/issue-core", + "issue-core>=0.2,<0.3", "gunicorn>=22.0", ] +[tool.uv.sources] +issue-core = { index = "gitea" } + +[[tool.uv.index]] +name = "gitea" +url = "https://gitea.coulomb.social/api/packages/coulomb/pypi/simple/" +explicit = true + [dependency-groups] dev = [ "pytest-django>=4.8",