Add build workflow

This commit is contained in:
Aleksandar Puharic 2022-07-08 22:22:50 +02:00
parent fda4e4c019
commit 48f32f40f3
Signed by: xZero707
GPG Key ID: 3CC53DCAA9C237BB
3 changed files with 61 additions and 0 deletions

35
.github/workflows/image.yml vendored Normal file
View File

@ -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

3
build/bin/build Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env sh
docker buildx bake --push --file build/docker-bake.hcl

23
build/docker-bake.hcl Normal file
View File

@ -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"
}
}