Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: cloud builder for multi arch builds #163

Merged
merged 6 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/publish-cloud-builder.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
# Automatically build Docker images using a cloud builder and publish them to a
# container registry using HCL Bake file.

name: Build Docker Images using Cloud Builder

on:
push:
branches: ['main']
tags: ['*']

jobs:
bake-target:
name: Determine bake target
runs-on: ubuntu-22.04 # don't use the big runners for this small step
outputs:
target: ${{ steps.generate.outputs.bake_target }}
steps:
- name: Determine target
id: generate
run: |
if [[ '${{ github.event_name }}' == 'pull_request' ]]; then
TGT=default
else
TGT=prod
fi

echo "$TGT"
echo "bake_target=${TGT,,}" >> ${GITHUB_OUTPUT}

- name: Show Generated Target
run: echo ${{ steps.generate.outputs.bake_target }}

# Build and Publish all targets associated with specified group
bake:
needs:
- bake-target
uses: darpa-askem/sciml-service/.github/workflows/bake-publish-cloud-builder.yaml@main
with:
file: 'docker/docker-bake.hcl'
group: ${{ needs.bake-target.outputs.target }}
registry: 'ghcr.io'
organization: ${{ github.repository_owner }}
secrets:
username: ${{ secrets.DOCKER_CLOUD_BUILD_USERNAME }}
token: ${{ secrets.DOCKER_CLOUD_BUILD_TOKEN }}
endpoint: "${{ secrets.DOCKER_CLOUD_BUILD_ENDPOINT }}"

# Execute simulation-integration reporting
simulation-integration:
runs-on: ubuntu-latest
needs:
- bake
steps:
- name: Report
env:
GITHUB_TOKEN: ${{ secrets.GHP_ACCESS_TOKEN }}
run: |
gh workflow run report.yaml --repo DARPA-ASKEM/simulation-integration --ref main


64 changes: 0 additions & 64 deletions .github/workflows/publish.yaml

This file was deleted.

10 changes: 7 additions & 3 deletions docker/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,13 @@ group "default" {
}

# ----------------------------------------------------------------------------------------------------------------------
# Used by the metafile GH action
# DO NOT ADD ANYTHING HERE THIS WILL BE POPULATED DYNAMICALLY
# MAKE SURE THIS IS INHERITED NEAR THE END SO THAT IT DOES NOT GET OVERRIDEN
target "docker-metadata-action" {}

# Removed linux/arm64 for now to ass CI build - Dec 2022
target "_platforms" {
platforms = ["linux/amd64"]
platforms = ["linux/amd64", "linux/arm64"]
}

target "sciml-service-base" {
Expand All @@ -48,6 +51,7 @@ target "sciml-service-base" {
dockerfile = "docker/Dockerfile.api"
}

# NOTE: target name will be used as the name of the image
target "sciml-service" {
inherits = ["_platforms", "sciml-service-base"]
inherits = ["sciml-service-base", "docker-metadata-action", "_platforms"]
}
Loading