File size: 2,115 Bytes
a868d84
 
3952e0d
 
 
 
a868d84
 
b76ccd0
e2d3702
 
 
 
8a0fa3c
e2d3702
 
 
 
a868d84
e2d3702
 
 
 
a868d84
e2d3702
 
a868d84
25b05a9
09e735e
25b05a9
09e735e
6146778
 
c0f93c8
6146778
c0f93c8
 
94205fe
 
 
6146778
94205fe
 
c0f93c8
94205fe
 
 
 
 
6146778
 
09e735e
a868d84
 
e2d3702
 
 
8294df1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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"]