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