Fix build: Switch to HTTPS for private dependency using CR_PAT
Some checks failed
Build and Push Docker Image / build (push) Failing after 16s

This commit is contained in:
2026-04-24 01:42:12 +00:00
parent 299b1bbc5e
commit 76e19a82dc
4 changed files with 11 additions and 11 deletions

View File

@@ -4,20 +4,21 @@ ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
WORKDIR /app
# Enable SSH for git dependencies
# Install git for dependency installation
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
ssh-client \
&& rm -rf /var/lib/apt/lists/*
# Add gitea.ext.ben.io to known hosts
RUN mkdir -p -m 0700 ~/.ssh && ssh-keyscan git.local.ben.io >> ~/.ssh/known_hosts
# Use Gitea PAT for private dependencies if provided
ARG GITEA_TOKEN
RUN if [ -n "$GITEA_TOKEN" ]; then \
git config --global url."https://b3nw:${GITEA_TOKEN}@gitea.ext.ben.io/".insteadOf "https://gitea.ext.ben.io/"; \
fi
# Install dependencies
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=secret,id=ssh_key,target=/root/.ssh/id_rsa \
uv sync --frozen --no-install-project --no-dev
# Copy the rest of the application
@@ -25,7 +26,6 @@ COPY . /app
# Install the project
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=secret,id=ssh_key,target=/root/.ssh/id_rsa \
uv sync --frozen --no-dev
FROM python:3.12-slim-bookworm