chrisjcc commited on
Commit
09e735e
Β·
1 Parent(s): 769d0ab

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -11
Dockerfile CHANGED
@@ -15,18 +15,37 @@ COPY requirements.txt .
15
  COPY . .
16
 
17
  # -----------------------------
18
- # Install private confluence-ingestor wheel using BuildKit secret
19
  # -----------------------------
20
- RUN --mount=type=secret,id=GITHUB_TOKEN \
21
- sh -c '\
22
- TOKEN=$(cat /run/secrets/GITHUB_TOKEN) && \
23
- echo "Downloading private wheel..." && \
24
- curl -fL -H "Authorization: token $TOKEN" \
25
- -o confluence_ingestor-0.3.0-py3-none-any.whl \
26
- https://github.com/chrisjcc/confluence-ingestor/releases/download/v0.0.1/confluence_ingestor-0.3.0-py3-none-any.whl && \
27
- echo "Installing wheel..." && \
28
- pip install --no-cache-dir ./confluence_ingestor-0.3.0-py3-none-any.whl && \
29
- rm -f confluence_ingestor-0.3.0-py3-none-any.whl'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
  # Install other dependencies
32
  RUN pip install --no-cache-dir -r requirements.txt
 
15
  COPY . .
16
 
17
  # -----------------------------
18
+ # Install private GitHub confluence-ingestor wheel using BuildKit secret
19
  # -----------------------------
20
+ ARG GITHUB_USERNAME=chrisjcc
21
+ ARG GITHUB_REPO_NAME=confluence-ingestor
22
+ ARG WHEEL_NAME="confluence_ingestor-0.3.0-py3-none-any.whl"
23
+
24
+ RUN --mount=type=secret,id=GITHUB_TOKEN,mode=0444,required=true \
25
+ GITHUB_TOKEN=$(cat /run/secrets/GITHUB_TOKEN) \
26
+ && echo "βœ… GITHUB_TOKEN is set" \
27
+ && echo "πŸ” Fetching release tag..." \
28
+ && RELEASE_TAG=$(curl -s \
29
+ -H "Authorization: token ${GITHUB_TOKEN}" \
30
+ "https://api.github.com/repos/${GITHUB_USERNAME}/${GITHUB_REPO_NAME}/releases" \
31
+ | jq -r '.[0].tag_name') \
32
+ && echo "🏷️ Release tag: ${RELEASE_TAG}" \
33
+ && ASSET_ID=$(curl -s \
34
+ -H "Authorization: token ${GITHUB_TOKEN}" \
35
+ "https://api.github.com/repos/${GITHUB_USERNAME}/${GITHUB_REPO_NAME}/releases/tags/${RELEASE_TAG}" \
36
+ | jq -r '.assets[] | select(.name=="'"${WHEEL_NAME}"'") | .id') \
37
+ && echo "πŸ“¦ Asset ID: ${ASSET_ID}" \
38
+ && echo "πŸ“₯ Downloading wheel..." \
39
+ && curl -fL \
40
+ -H "Authorization: token ${GITHUB_TOKEN}" \
41
+ -H "Accept: application/octet-stream" \
42
+ -o /tmp/${WHEEL_NAME} \
43
+ "https://api.github.com/repos/${GITHUB_USERNAME}/${GITHUB_REPO_NAME}/releases/assets/${ASSET_ID}" \
44
+ && echo "πŸ“¦ Installing wheel..." \
45
+ && pip install --no-cache-dir /tmp/${WHEEL_NAME} \
46
+ && rm -f /tmp/${WHEEL_NAME} \
47
+ && echo "βœ… Installed ${WHEEL_NAME}"
48
+
49
 
50
  # Install other dependencies
51
  RUN pip install --no-cache-dir -r requirements.txt