File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Build Python image
2+
3+ on :
4+ push :
5+
6+ jobs :
7+ build :
8+ uses : ./.github/workflows/reusable-build.yml
9+ secrets : inherit
10+ with :
11+ image : python
12+ tag : " 3"
Original file line number Diff line number Diff line change 1+ name : Build image
2+
3+ on :
4+ workflow_call :
5+ inputs :
6+ image :
7+ required : true
8+ type : string
9+ tag :
10+ required : true
11+ type : string
12+
13+ env :
14+ REGISTRY : ghcr.io
15+ IMAGE_REPOSITORY : ${{ github.repository }}
16+ IMAGE_NAME : ${{ inputs.image }}
17+ IMAGE_TAG : ${{ inputs.tag }}
18+
19+ jobs :
20+ build :
21+ runs-on : ubuntu-latest
22+ permissions :
23+ contents : read
24+ packages : write
25+ steps :
26+ - uses : actions/checkout@v4
27+ - uses : docker/setup-buildx-action@v3
28+ - uses : docker/login-action@v3
29+ with :
30+ registry : ${{ env.REGISTRY }}
31+ username : ${{ github.actor }}
32+ password : ${{ secrets.GITHUB_TOKEN }}
33+ - uses : docker/metadata-action@v5
34+ id : tags
35+ with :
36+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_REPOSITORY }}/${{ env.IMAGE_NAME }}
37+ tags : |
38+ type=raw,value=${{ env.IMAGE_TAG }}
39+ - name : Image metadata
40+ uses : docker/metadata-action@v5
41+ id : meta
42+ with :
43+ labels : |
44+ me.dusansimic.devcontainers.${{ env.IMAGE_NAME }}.version=${{ env.IMAGE_TAG }}
45+ - uses : docker/build-push-action@v5
46+ with :
47+ context : .
48+ push : ${{ github.event_name != 'pull_request' }}
49+ tags : ${{ github.ref_type == 'tag' && steps.tags.outputs.tags }}
50+ labels : ${{ steps.meta.outputs.labels }}
Original file line number Diff line number Diff line change 1+ FROM mcr.microsoft.com/devcontainers/python:3
2+
3+ COPY install_ruff.sh install_uv.sh /tmp/
4+
5+ RUN \
6+ bash /tmp/install_ruff.sh && \
7+ bash /tmp/install_uv.sh
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+
4+ ORG_PROJ=" astral-sh/ruff"
5+ RELTAG=" latest"
6+
7+ API_JSON=$( mktemp /tmp/api-XXXXXXXX.json)
8+ API=" https://api.github.com/repos/${ORG_PROJ} /releases/${RELTAG} "
9+
10+ curl --fail --retry 5 --retry-delay 5 --retry-all-errors -sL ${API} -o ${API_JSON}
11+ TGZ_URLS=($( cat ${API_JSON} |
12+ jq \
13+ -r \
14+ ' .assets | sort_by(.created_at) | reverse | .[] | select(.name|test("x86_64")) | select(.name|test("linux-gnu.tar.gz$")) | .browser_download_url'
15+ ) )
16+
17+ TGZ_FILE=$( mktemp /tmp/XXXXXXXX.tgz)
18+
19+ curl --fail --retry 5 --retry-delay 5 --retry-all-errors -sL ${TGZ_URLS} -o ${TGZ_FILE}
20+
21+ tar -xzf ${TGZ_FILE} --strip-components=1 -C /usr/bin
22+
23+ # cleanup
24+
25+ rm $API_JSON $TGZ_FILE
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+
4+ ORG_PROJ=" astral-sh/uv"
5+ RELTAG=" latest"
6+
7+ API_JSON=$( mktemp /tmp/api-XXXXXXXX.json)
8+ API=" https://api.github.com/repos/${ORG_PROJ} /releases/${RELTAG} "
9+
10+ curl --fail --retry 5 --retry-delay 5 --retry-all-errors -sL ${API} -o ${API_JSON}
11+ TGZ_URLS=($( cat ${API_JSON} |
12+ jq \
13+ -r \
14+ ' .assets | sort_by(.created_at) | reverse | .[] | select(.name|test("x86_64")) | select(.name|test("linux-gnu.tar.gz$")) | .browser_download_url'
15+ ) )
16+
17+ TGZ_FILE=$( mktemp /tmp/XXXXXXXX.tgz)
18+
19+ curl --fail --retry 5 --retry-delay 5 --retry-all-errors -sL ${TGZ_URLS} -o ${TGZ_FILE}
20+
21+ tar -xzf ${TGZ_FILE} --strip-components=1 -C /usr/bin
22+
23+ # cleanup
24+
25+ rm $API_JSON $TGZ_FILE
You can’t perform that action at this time.
0 commit comments