Spaces:
Runtime error
Runtime error
| FROM python:3.10-slim | |
| ARG GITHUB_USERNAME=chrisjcc | |
| ARG GITHUB_REPO_NAME=confluence-ingestor | |
| ARG WHEEL_NAME="confluence_ingestor-0.3.0-py3-none-any.whl" | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update --allow-releaseinfo-change \ | |
| && apt-get install -y --no-install-recommends \ | |
| curl unzip git jq \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # ----------------------------- | |
| # Copy ALL application code first | |
| # ----------------------------- | |
| COPY . . | |
| # ----------------------------- | |
| # Update pip | |
| # ----------------------------- | |
| RUN pip install --upgrade pip | |
| # Install other dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # ----------------------------- | |
| # Install private GitHub confluence-ingestor wheel using BuildKit secret | |
| # ----------------------------- | |
| RUN --mount=type=secret,id=GITHUB_TOKEN,mode=0444,required=true \ | |
| GITHUB_TOKEN=$(cat /run/secrets/GITHUB_TOKEN) \ | |
| && echo "β GITHUB_TOKEN set (length: ${#GITHUB_TOKEN})" \ | |
| && echo "π Fetching latest release..." \ | |
| && curl -s -L -H "Authorization: token ${GITHUB_TOKEN}" \ | |
| "https://api.github.com/repos/${GITHUB_USERNAME}/${GITHUB_REPO_NAME}/releases/latest" \ | |
| | tee /tmp/release.json \ | |
| && ASSET_URL=$(cat /tmp/release.json | jq -r '.assets[0].url // empty') \ | |
| && echo "π₯ Downloading from GitHub API asset URL: ${ASSET_URL}" \ | |
| && curl -s -L \ | |
| -H "Authorization: token ${GITHUB_TOKEN}" \ | |
| -H "Accept: application/octet-stream" \ | |
| -o /tmp/${WHEEL_NAME} \ | |
| "${ASSET_URL}" \ | |
| && echo "π Downloaded file size: $(ls -lh /tmp/${WHEEL_NAME})" \ | |
| && if [ ! -s /tmp/${WHEEL_NAME} ]; then echo "β Empty wheel file"; exit 1; fi \ | |
| && echo "π§ Installing wheel..." \ | |
| && pip install --no-cache-dir --verbose /tmp/${WHEEL_NAME} \ | |
| && python -c "import confluence_ingestor; print('β confluence_ingestor import OK')" \ | |
| && pip list | grep confluence || echo "β Installation verified" \ | |
| && rm /tmp/*.* | |
| EXPOSE 7860 | |
| # ----------------------------- | |
| # Entrypoint | |
| # ----------------------------- | |
| CMD ["python", "app.py"] |