chrisjcc's picture
Use API asset URL (.assets[0].url) instead of browser_download_url - this requires authentication properly
5ce5a2b verified
Raw
History Blame
2.19 kB
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 \
echo "βœ… GITHUB_TOKEN is set" \
&& echo "πŸ” Fetching latest release..." \
&& curl -s -L -H "Authorization: token $(cat /run/secrets/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') \
&& if [ -z "$ASSET_URL" ]; then echo "❌ No asset URL"; exit 1; fi \
&& echo "πŸ“₯ Downloading from GitHub API asset URL: ${ASSET_URL}" \
&& curl -s -L \
-H "Authorization: token $(cat /run/secrets/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} \
&& rm -f /tmp/release.json /tmp/${WHEEL_NAME} \
&& python -c "import confluence_ingestor; print('βœ“ confluence_ingestor import OK')" \
&& pip list | grep confluence || echo "βœ… Installation verified"
EXPOSE 7860
# -----------------------------
# Entrypoint
# -----------------------------
CMD ["python", "app_with_confluence.py"]