-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build (cross platform) images using 'bake'
Locally run `docker buildx bake`
- Loading branch information
Showing
10 changed files
with
292 additions
and
11 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.github | ||
.idea/ | ||
.git/ | ||
chrome/ | ||
|
@@ -12,3 +13,4 @@ compose/ | |
*.sh | ||
LICENSE.txt | ||
README.md | ||
docker-bake.hcl |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
|
||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
name: publish-cross-platform-images | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
paths-ignore: | ||
- '*.sh' | ||
- 'README.md' | ||
- 'compose' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
platform: [linux/amd64, linux/arm64] | ||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
hsac/fitnesse-fixtures-test-jre11 | ||
hsac/fitnesse-fixtures-combine | ||
hsac/fitnesse-fixtures-test-jre11-chrome | ||
hsac/fitnesse-fixtures-test-jre11-with-pdf | ||
hsac/fitnesse-fixtures-test-jre11-chrome-with-pdf | ||
- name: Rename meta bake definition file | ||
run: | | ||
mv "${{ steps.meta.outputs.bake-file }}" "/tmp/bake-meta.json" | ||
- name: Upload meta bake definition | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: bake-meta | ||
path: /tmp/bake-meta.json | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build | ||
id: bake | ||
uses: docker/bake-action@v4 | ||
with: | ||
files: | | ||
./docker-bake.hcl | ||
/tmp/bake-meta.json | ||
targets: | | ||
test | ||
chrome | ||
combine | ||
test-with-pdf | ||
chrome-with-pdf | ||
set: | | ||
*.tags= | ||
*.platform=${{ matrix.platform }} | ||
test.output=type=image,"name=hsac/fitnesse-fixtures-test-jre11",push-by-digest=true,name-canonical=true,push=true | ||
combine.output=type=image,"name=hsac/fitnesse-fixtures-combine",push-by-digest=true,name-canonical=true,push=true | ||
chrome.output=type=image,"name=hsac/fitnesse-fixtures-test-jre11-chrome",push-by-digest=true,name-canonical=true,push=true | ||
test-with-pdf.output=type=image,"name=hsac/fitnesse-fixtures-test-jre11-with-pdf",push-by-digest=true,name-canonical=true,push=true | ||
chrome-with-pdf.output=type=image,"name=hsac/fitnesse-fixtures-test-jre11-chrome-with-pdf",push-by-digest=true,name-canonical=true,push=true | ||
- name: Export digests | ||
run: | | ||
mkdir -p /tmp/digests/test | ||
test_digest="${{ fromJSON(steps.bake.outputs.metadata)['test']['containerimage.digest'] }}" | ||
touch "/tmp/digests/test/${test_digest#sha256:}" | ||
mkdir -p /tmp/digests/combine | ||
combine_digest="${{ fromJSON(steps.bake.outputs.metadata)['combine']['containerimage.digest'] }}" | ||
touch "/tmp/digests/combine/${combine_digest#sha256:}" | ||
mkdir -p /tmp/digests/chrome | ||
chrome_digest="${{ fromJSON(steps.bake.outputs.metadata)['chrome']['containerimage.digest'] }}" | ||
touch "/tmp/digests/chrome/${chrome_digest#sha256:}" | ||
mkdir -p /tmp/digests/test-with-pdf | ||
test_with_pdf_digest="${{ fromJSON(steps.bake.outputs.metadata)['test-with-pdf']['containerimage.digest'] }}" | ||
touch "/tmp/digests/test-with-pdf/${test_with_pdf_digest#sha256:}" | ||
mkdir -p /tmp/digests/chrome-with-pdf | ||
chrome_with_pdf_digest="${{ fromJSON(steps.bake.outputs.metadata)['chrome-with-pdf']['containerimage.digest'] }}" | ||
touch "/tmp/digests/chrome-with-pdf/${chrome_with_pdf_digest#sha256:}" | ||
- name: Upload digest | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: digests | ||
path: /tmp/digests/* | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
- name: Test test image | ||
if: matrix.platform == 'linux/amd64' | ||
run: | | ||
SHA="sha256:$(cd /tmp/digests/test; ls *)" | ||
IMAGE="hsac/fitnesse-fixtures-test-jre11@${SHA}" | ||
docker run --rm -v "$(pwd)"/src/main/wiki:/fitnesse/wiki/FitNesseRoot -e RE_RUN_FAILED=true ${IMAGE} -DfitnesseSuiteToRun=SampleTests.SlimTests.UtilityFixtures | ||
- name: Test chrome image | ||
if: matrix.platform == 'linux/amd64' | ||
run: | | ||
SHA="sha256:$(cd /tmp/digests/chrome; ls *)" | ||
IMAGE="hsac/fitnesse-fixtures-test-jre11-chrome@${SHA}" | ||
docker run --rm -v "$(pwd)"/src/main/wiki:/fitnesse/wiki/FitNesseRoot -e RE_RUN_FAILED=true ${IMAGE} -DfitnesseSuiteToRun=SampleTests.SlimTests.BrowserTest | ||
merge: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
target: [test, combine, chrome, test-with-pdf, chrome-with-pdf] | ||
include: | ||
- target: test | ||
image: hsac/fitnesse-fixtures-test-jre11 | ||
- target: combine | ||
image: hsac/fitnesse-fixtures-combine | ||
- target: chrome | ||
image: hsac/fitnesse-fixtures-test-jre11-chrome | ||
- target: test-with-pdf | ||
image: hsac/fitnesse-fixtures-test-jre11-with-pdf | ||
- target: chrome-with-pdf | ||
image: hsac/fitnesse-fixtures-test-jre11-chrome-with-pdf | ||
steps: | ||
- name: Download meta bake definition | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: bake-meta | ||
path: /tmp | ||
|
||
- name: Download digests | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: digests | ||
path: /tmp/digests | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Create manifest list and push | ||
working-directory: /tmp/digests/${{ matrix.target }} | ||
run: | | ||
docker buildx imagetools create $(jq -cr '.target."docker-metadata-action".tags | map(select(startswith("${{ matrix.image }}")) | "-t " + .) | join(" ")' /tmp/bake-meta.json) \ | ||
$(printf '${{ matrix.image }}@sha256:%s ' *) | ||
- name: Inspect image | ||
run: | | ||
docker buildx imagetools inspect ${{ matrix.image }}:$(jq -r '.target."docker-metadata-action".args.DOCKER_META_VERSION' /tmp/bake-meta.json) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
ARG MAVEN_VERSION=3.8-amazoncorretto-11 | ||
ARG MAVEN_VERSION=3.8-amazoncorretto-11 | ||
FROM maven:${MAVEN_VERSION} as build | ||
ARG VERSION=5.3.0 | ||
RUN mkdir -p /usr/src | ||
WORKDIR /usr/src | ||
|
||
COPY pom.xml . | ||
|
||
RUN mvn compile | ||
RUN mvn compile -Dhsac.fixtures.version=${VERSION} | ||
|
||
COPY src/ ./src | ||
|
||
RUN mvn package | ||
RUN mvn package -Dhsac.fixtures.version=${VERSION} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
ARG TEST_PDF_IMAGE=hsac/fitnesse-fixtures-test-jre11-with-pdf:latest | ||
ARG TEST_CHROME_IMAGE=hsac/fitnesse-fixtures-test-jre11-chrome:latest | ||
|
||
FROM ${TEST_PDF_IMAGE} as test | ||
FROM ${TEST_PDF_IMAGE} as test-with-pdf | ||
|
||
FROM ${TEST_CHROME_IMAGE} | ||
COPY --from=test /fitnesse/wiki/fixtures /fitnesse/wiki/fixtures | ||
FROM ${TEST_CHROME_IMAGE} as hsac-chrome | ||
|
||
FROM hsac-chrome | ||
COPY --from=test-with-pdf /fitnesse/wiki/fixtures /fitnesse/wiki/fixtures |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
variable "VERSION" { | ||
default = "5.3.1" | ||
} | ||
variable "SELENIUM_VERSION" { | ||
default = "latest" | ||
} | ||
variable "TAG" { | ||
default = "latest" | ||
} | ||
|
||
// Special target: https://github.com/docker/metadata-action#bake-definition | ||
target "docker-metadata-action" {} | ||
|
||
group "default" { | ||
targets = ["base", "test", "test-with-pdf", "chrome", "chrome-with-pdf", "combine"] | ||
} | ||
|
||
target "base" { | ||
inherits = ["docker-metadata-action"] | ||
context = "." | ||
dockerfile = "Dockerfile" | ||
pull = true | ||
args = { | ||
VERSION = "${VERSION}" | ||
} | ||
tags = ["hsac/fitnesse-fixtures-test-jre11:base-${TAG}"] | ||
} | ||
|
||
target "test" { | ||
inherits = ["docker-metadata-action"] | ||
context = "test" | ||
dockerfile = "Dockerfile" | ||
pull = true | ||
contexts = { | ||
base = "target:base" | ||
jre = "docker-image://eclipse-temurin:11-jre" | ||
} | ||
tags = ["hsac/fitnesse-fixtures-test-jre11:${TAG}"] | ||
} | ||
|
||
target "test-with-pdf" { | ||
inherits = ["docker-metadata-action"] | ||
context = "test-with-pdf" | ||
dockerfile = "Dockerfile" | ||
contexts = { | ||
base = "target:base" | ||
hsac-fixtures = "target:test" | ||
} | ||
tags = ["hsac/fitnesse-fixtures-test-jre11-with-pdf:${TAG}"] | ||
} | ||
|
||
target "chrome" { | ||
inherits = ["docker-metadata-action"] | ||
context = "chrome" | ||
dockerfile = "Dockerfile" | ||
pull = true | ||
contexts = { | ||
selenium = "docker-image://seleniarm/standalone-chromium:${SELENIUM_VERSION}" | ||
hsac-fixtures = "target:test" | ||
} | ||
tags = ["hsac/fitnesse-fixtures-test-jre11-chrome:${TAG}"] | ||
} | ||
|
||
target "chrome-with-pdf" { | ||
inherits = ["docker-metadata-action"] | ||
context = "chrome-with-pdf" | ||
dockerfile = "Dockerfile" | ||
contexts = { | ||
test-with-pdf = "target:test-with-pdf" | ||
hsac-chrome = "target:chrome" | ||
} | ||
tags = ["hsac/fitnesse-fixtures-test-jre11-chrome-with-pdf:${TAG}"] | ||
} | ||
|
||
target "combine" { | ||
inherits = ["docker-metadata-action"] | ||
context = "combine" | ||
dockerfile = "Dockerfile" | ||
pull = true | ||
contexts = { | ||
base = "target:base" | ||
graal = "docker-image://ghcr.io/graalvm/native-image:latest" | ||
busybox = "docker-image://busybox:latest" | ||
} | ||
tags = ["hsac/fitnesse-fixtures-combine:${TAG}"] | ||
} |
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
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