Skip to content

Commit

Permalink
Split up builds
Browse files Browse the repository at this point in the history
  • Loading branch information
fivegrant committed Feb 9, 2024
1 parent f1a2245 commit b7fe523
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,26 @@ jobs:
# echo "tag=$TAG" >> $GITHUB_OUTPUT

# Build and Publish all targets associated with specified group
bake:
bake-arm64:
# needs:
# - generate-tag
uses: darpa-askem/.github/.github/workflows/bake-publish.yml@main
with:
file: 'docker/docker-bake.hcl'
file: 'docker/docker-bake-arm64.hcl'
group: 'prod'
registry: 'ghcr.io'
organization: ${{ github.repository_owner }}
# tag: ${{ needs.generate-tag.outputs.tag }}
secrets:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

bake-amd64:
# needs:
# - generate-tag
uses: darpa-askem/.github/.github/workflows/bake-publish.yml@main
with:
file: 'docker/docker-bake-amd64.hcl'
group: 'prod'
registry: 'ghcr.io'
organization: ${{ github.repository_owner }}
Expand Down
54 changes: 54 additions & 0 deletions docker/docker-bake-amd64.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
variable "DOCKER_REGISTRY" {
default = "ghcr.io"
}
variable "DOCKER_ORG" {
default = "darpa-askem"
}
variable "VERSION" {
default = "local"
}

# ----------------------------------------------------------------------------------------------------------------------

function "buildtag" {
params = [image_name, prefix, suffix]
result = [ "${DOCKER_REGISTRY}/${DOCKER_ORG}/${image_name}:${check_prefix(prefix)}${VERSION}${check_suffix(suffix)}", "${image_name}:build" ]
}

function "tag" {
params = [image_name, prefix, suffix]
result = [ "${DOCKER_REGISTRY}/${DOCKER_ORG}/${image_name}:${check_prefix(prefix)}${VERSION}${check_suffix(suffix)}" ]
}

function "check_prefix" {
params = [tag]
result = notequal("",tag) ? "${tag}-": ""
}

function "check_suffix" {
params = [tag]
result = notequal("",tag) ? "-${tag}": ""
}

# ----------------------------------------------------------------------------------------------------------------------

group "prod" {
targets = ["askem-julia"]
}

group "default" {
targets = []
}

# ----------------------------------------------------------------------------------------------------------------------

target "_platforms" {
platforms = ["linux/amd64"]
}

target "askem-julia" {
inherits = ["_platforms"]
context = "."
tags = tag("askem-julia", "", "")
dockerfile = "docker/Dockerfile"
}
54 changes: 54 additions & 0 deletions docker/docker-bake-arm64.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
variable "DOCKER_REGISTRY" {
default = "ghcr.io"
}
variable "DOCKER_ORG" {
default = "darpa-askem"
}
variable "VERSION" {
default = "local"
}

# ----------------------------------------------------------------------------------------------------------------------

function "buildtag" {
params = [image_name, prefix, suffix]
result = [ "${DOCKER_REGISTRY}/${DOCKER_ORG}/${image_name}:${check_prefix(prefix)}${VERSION}${check_suffix(suffix)}", "${image_name}:build" ]
}

function "tag" {
params = [image_name, prefix, suffix]
result = [ "${DOCKER_REGISTRY}/${DOCKER_ORG}/${image_name}:${check_prefix(prefix)}${VERSION}${check_suffix(suffix)}" ]
}

function "check_prefix" {
params = [tag]
result = notequal("",tag) ? "${tag}-": ""
}

function "check_suffix" {
params = [tag]
result = notequal("",tag) ? "-${tag}": ""
}

# ----------------------------------------------------------------------------------------------------------------------

group "prod" {
targets = ["askem-julia"]
}

group "default" {
targets = []
}

# ----------------------------------------------------------------------------------------------------------------------

target "_platforms" {
platforms = ["linux/arm64"]
}

target "askem-julia" {
inherits = ["_platforms"]
context = "."
tags = tag("askem-julia", "", "")
dockerfile = "docker/Dockerfile"
}

0 comments on commit b7fe523

Please sign in to comment.