Skip to content

Merge pull request #11 from adh-partnership/dhawton/fix-entrypoint #9

Merge pull request #11 from adh-partnership/dhawton/fix-entrypoint

Merge pull request #11 from adh-partnership/dhawton/fix-entrypoint #9

Workflow file for this run

name: "Build"
on:
push:
branches: ['master']
env:
HUB: ${{ secrets.DOCKER_USERNAME }}
IMG: "bot"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set sha_short
id: vars
run: |-
echo "sha_short=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV
- name: Install Cosign
if: ${{ github.event_name == 'push' }}
uses: sigstore/cosign-installer@main
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Docker Image
run: |
BASE_DISTRIBUTION=distroless HUB="${{ env.HUB }}" IMG="${{ env.IMG }}" TAG="${{ env.sha_short }}" make docker
BASE_DISTRUBITION=debug HUB="${{ env.HUB }}" IMG="${{ env.IMG }}" TAG="${{ env.sha_short }}-debug" make docker
- name: Push Docker Image
run: |
docker push ${{ env.HUB }}/${{ env.IMG }}:${{ env.sha_short }}
docker push ${{ env.HUB }}/${{ env.IMG }}:${{ env.sha_short }}-debug
- name: Sign Images
env:
COSIGN_PASSWORD: ${{ secrets.COSIGN_PRIVATE_KEY_PASSWORD }}
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_PRIVATE_KEY }}
run: |
image_digest="$(docker inspect --format='{{index .RepoDigests 0}}' ${{ env.HUB }}/${{ env.IMG }}:${{ env.sha_short }})"
image_digest_debug="$(docker inspect --format='{{index .RepoDigests 0}}' ${{ env.HUB }}/${{ env.IMG }}:${{ env.sha_short }}-debug)"
cosign sign --key env://COSIGN_PRIVATE_KEY --yes ${image_digest}
cosign sign --key env://COSIGN_PRIVATE_KEY --yes ${image_digest_debug}