Add production deployment for circomspect #6
Workflow file for this run
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 and Deploy Tagged Versions | |
on: | |
# Runs on pushes targeting the default branch. | |
push: | |
branches: ["main"] | |
# TODO: remove me. | |
pull_request: | |
# Allows you to run this workflow manually from the Actions tab. | |
workflow_dispatch: | |
jobs: | |
# Single deploy job since we're just deploying. | |
deploy: | |
strategy: | |
matrix: | |
include: | |
- image: "circomspect" | |
github_repository: "trailofbits/circomspect" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Install SlimTookit | |
run: | | |
curl -sL https://raw.githubusercontent.com/slimtoolkit/slim/master/scripts/install-slim.sh | sudo -E bash - | |
- name: Build and Deploy Images | |
run: | | |
echo "Building all tags for ${{ matrix.github_repository }}..." | |
for tag in $(./scripts/list-tags.sh ${{ matrix.github_repository }}); do | |
echo "Building ${{ matrix.image }}:${tag}..." | |
docker buildx build -f images/${{ matrix.image }}/Dockerfile --build-arg "TAG=${tag}" -t ${{ matrix.image }}:unoptimized --load images/${{ matrix.image }}/ | |
echo "Optimizing ${{ matrix.image }}:${tag}..." | |
slim build --target ${{ matrix.image }}:unoptimized \ | |
--tag "sindrilabs/${{ matrix.image }}:${tag}" \ | |
--tag sindrilabs/${{ matrix.image }}:latest \ | |
--http-probe=false \ | |
--exclude-pattern '/tmp/*' \ | |
--mount "./images/${{ matrix.image }}/:/sindri/" \ | |
--exec "./test.sh" | |
echo "Publishing ${{ matrix.image }}:${tag}..." | |
docker push "sindrilabs/${{ matrix.image }}:${tag}" | |
done | |
echo "Publishing ${{ matrix.image }}:latest..." | |
docker push sindrilabs/${{ matrix.image }}:latest |