Fix: Install dependencies from Gitea release, not local cache

Problem: Dockerfile copied local requirements.txt before downloading from Gitea,
causing it to use old dependencies without aiohttp.

Solution: Download release first, THEN install requirements from the release.
This commit is contained in:
Christian 2025-12-17 21:10:31 +01:00
parent 1b1045a0c7
commit 15905d676a

View File

@ -16,20 +16,23 @@ RUN apt-get update && apt-get install -y \
ARG RELEASE_VERSION=latest ARG RELEASE_VERSION=latest
ARG GITHUB_TOKEN ARG GITHUB_TOKEN
ARG GITHUB_REPO=ct/bmc_hub ARG GITHUB_REPO=ct/bmc_hub
ARG GITEA_URL=https://g.bmcnetworks.dk
# Copy requirements first for better caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# If RELEASE_VERSION is set and not "latest", pull from GitHub release # If RELEASE_VERSION is set and not "latest", pull from GitHub release
# Otherwise, copy local files # Otherwise, copy local files
RUN if [ "$RELEASE_VERSION" != "latest" ] && [ -n "$GITHUB_TOKEN" ]; then \ RUN if [ "$RELEASE_VERSION" != "latest" ] && [ -n "$GITHUB_TOKEN" ]; then \
echo "Downloading release ${RELEASE_VERSION} from GitHub..." && \ echo "Downloading release ${RELEASE_VERSION} from Gitea..." && \
curl -H "Authorization: token ${GITHUB_TOKEN}" \ curl -H "Authorization: token ${GITHUB_TOKEN}" \
-L "https://g.bmcnetworks.dk/api/v1/repos/${GITHUB_REPO}/archive/${RELEASE_VERSION}.tar.gz" \ -L "${GITEA_URL}/api/v1/repos/${GITHUB_REPO}/archive/${RELEASE_VERSION}.tar.gz" \
-o /tmp/release.tar.gz && \ -o /tmp/release.tar.gz && \
tar -xzf /tmp/release.tar.gz --strip-components=1 -C /app && \ tar -xzf /tmp/release.tar.gz --strip-components=1 -C /app && \
rm /tmp/release.tar.gz; \ rm /tmp/release.tar.gz && \
echo "Installing dependencies from release..." && \
pip install --no-cache-dir -r requirements.txt; \
else \
echo "Using local files..." && \
cp requirements.txt /tmp/requirements.txt && \
pip install --no-cache-dir -r /tmp/requirements.txt; \
fi fi
# Copy application code (only used if not downloading from GitHub) # Copy application code (only used if not downloading from GitHub)