build(Dockerfile): bump python latest tag digest (#134) #55
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: build rwalk | |
"on": | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- LICENSE | |
- README.md | |
- fly.toml | |
- .github/workflows/build.yml | |
- .github/workflows/deploy.yml | |
- .github/workflows/digesta.yml | |
- .github/dependabot.yml | |
permissions: | |
contents: read | |
id-token: write | |
packages: write | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
BASE_IMAGE: cgr.dev/chainguard/python | |
jobs: | |
build: | |
name: build rwalk | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout project | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 | |
- name: get base image | |
id: base | |
run: | | |
set -x | |
DIGEST="$(awk -F '@' '/latest@/ {print $2}' Dockerfile)" | |
echo "Base image: ${BASE_IMAGE}:latest@${DIGEST}" | |
echo "image=${BASE_IMAGE}:latest@${DIGEST}" >> "$GITHUB_OUTPUT" | |
- name: setup python | |
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 | |
with: | |
python-version: '3.9' | |
- name: install poetry | |
uses: snok/install-poetry@93ada01c735cc8a383ce0ce2ae205a21c415379b | |
with: | |
virtualenvs-create: false | |
- name: export requirements.txt | |
run: | | |
poetry export -o requirements.txt | |
- name: install cosign | |
uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 | |
- name: verify base image signature | |
run: | | |
cosign verify \ | |
--certificate-identity \ | |
'https://github.com/chainguard-images/images/.github/workflows/release.yaml@refs/heads/main' \ | |
--certificate-oidc-issuer 'https://token.actions.githubusercontent.com' \ | |
"${{ steps.base.outputs.image }}" | jq . | |
- name: docker buildx | |
id: buildx | |
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 | |
- name: login ghcr.io | |
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: docker metadata | |
id: meta | |
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175 | |
with: | |
images: ${{ env.IMAGE_NAME }} | |
- name: build rwalk (devel) | |
id: docker | |
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 | |
with: | |
context: . | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:devel | |
labels: ${{ steps.meta.outputs.labels }} | |
builder: ${{ steps.buildx.outputs.name }} | |
sbom: true | |
provenance: true | |
- name: smoke test | |
run: | | |
set -x | |
docker run --rm --detach -p 8080:8080 --name smoke_rwalk \ | |
"${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.docker.outputs.digest }}" | |
sleep 3 | |
curl -X GET http://localhost:8080 || (docker logs smoke_rwalk && exit 1) | |
docker logs smoke_rwalk | |
docker stop smoke_rwalk | |
- name: cosign rwalk | |
run: | | |
cosign sign -y "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.docker.outputs.digest }}" | |
- name: install crane | |
uses: imjasonh/setup-crane@00c9e93efa4e1138c9a7a5c594acd6c75a2fbf0c | |
- name: tag rwalk (latest) | |
run: | | |
crane tag "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:devel" latest |