From 48f32f40f32c67b97a4d75532315b4bd175b937b Mon Sep 17 00:00:00 2001 From: xZero707 Date: Fri, 8 Jul 2022 22:22:50 +0200 Subject: [PATCH] Add build workflow --- .github/workflows/image.yml | 35 +++++++++++++++++++++++++++++++++++ build/bin/build | 3 +++ build/docker-bake.hcl | 23 +++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 .github/workflows/image.yml create mode 100755 build/bin/build create mode 100644 build/docker-bake.hcl diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml new file mode 100644 index 0000000..c3f162a --- /dev/null +++ b/.github/workflows/image.yml @@ -0,0 +1,35 @@ +name: Build docker WordPress image + +on: + push: + branches: master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: checkout code + uses: actions/checkout@v2 + - name: Cache Docker layers + uses: actions/cache@v2 + id: cache + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + with: + config-inline: | + [worker.oci] + max-parallelism = 16 + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Build image + run: build/bin/build \ No newline at end of file diff --git a/build/bin/build b/build/bin/build new file mode 100755 index 0000000..75d6d0b --- /dev/null +++ b/build/bin/build @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +docker buildx bake --push --file build/docker-bake.hcl diff --git a/build/docker-bake.hcl b/build/docker-bake.hcl new file mode 100644 index 0000000..7c958a3 --- /dev/null +++ b/build/docker-bake.hcl @@ -0,0 +1,23 @@ +group "default" { + targets = ["1_0"] +} + +target "build-dockerfile" { + dockerfile = "Dockerfile" +} + +target "build-platforms" { + platforms = ["linux/amd64"] +} + +target "build-common" { + pull = true +} + +target "1_0" { + inherits = ["build-dockerfile", "build-platforms", "build-common"] + tags = ["docker.io/nlss/bbk-cli:1", "docker.io/nlss/bbk-cli:1.0", "docker.io/nlss/bbk-cli:latest"] + args = { + BBKCLI_VERSION = "1.0" + } +} \ No newline at end of file