2020-08-16 00:36:41 +02:00
|
|
|
name: ci
|
|
|
|
|
|
|
|
on:
|
2020-10-23 00:38:26 +02:00
|
|
|
workflow_dispatch:
|
2022-08-12 16:45:35 +02:00
|
|
|
inputs:
|
|
|
|
buildx-version:
|
|
|
|
description: 'Buildx version or Git context'
|
|
|
|
default: 'latest'
|
|
|
|
required: false
|
|
|
|
buildkit-image:
|
|
|
|
description: 'BuildKit image'
|
|
|
|
default: 'moby/buildkit:buildx-stable-1'
|
|
|
|
required: false
|
2020-08-16 00:36:41 +02:00
|
|
|
push:
|
2020-09-12 20:53:25 +02:00
|
|
|
branches:
|
2022-01-18 14:57:27 +01:00
|
|
|
- 'master'
|
2020-08-16 00:36:41 +02:00
|
|
|
pull_request:
|
2020-09-12 20:53:25 +02:00
|
|
|
branches:
|
2022-01-18 14:57:27 +01:00
|
|
|
- 'master'
|
2020-08-16 00:36:41 +02:00
|
|
|
|
2022-08-17 02:17:37 +02:00
|
|
|
env:
|
|
|
|
BUILDX_VERSION: latest
|
|
|
|
BUILDKIT_IMAGE: moby/buildkit:buildx-stable-1
|
|
|
|
|
2020-08-16 00:36:41 +02:00
|
|
|
jobs:
|
2020-10-19 22:17:35 +02:00
|
|
|
minimal:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-02 12:03:44 +01:00
|
|
|
uses: actions/checkout@v3
|
2020-10-19 22:17:35 +02:00
|
|
|
with:
|
|
|
|
path: action
|
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2022-08-12 16:45:35 +02:00
|
|
|
with:
|
2022-08-17 02:17:37 +02:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-08-12 16:45:35 +02:00
|
|
|
driver-opts: |
|
2022-08-17 02:17:37 +02:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2020-10-19 22:17:35 +02:00
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./action
|
|
|
|
with:
|
|
|
|
file: ./test/Dockerfile
|
|
|
|
|
2020-09-02 10:07:11 +02:00
|
|
|
git-context:
|
2020-08-17 22:18:15 +02:00
|
|
|
runs-on: ubuntu-latest
|
2020-09-22 20:53:40 +02:00
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-02 12:03:44 +01:00
|
|
|
uses: actions/checkout@v3
|
2020-10-03 22:44:16 +02:00
|
|
|
with:
|
|
|
|
path: action
|
2020-09-22 20:53:40 +02:00
|
|
|
-
|
|
|
|
name: Set up QEMU
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2020-09-22 20:53:40 +02:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
|
|
|
id: buildx
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2020-09-22 20:53:40 +02:00
|
|
|
with:
|
2022-08-17 02:17:37 +02:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-08-12 16:45:35 +02:00
|
|
|
driver-opts: |
|
|
|
|
network=host
|
2022-08-17 02:17:37 +02:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2020-09-22 20:53:40 +02:00
|
|
|
-
|
|
|
|
name: Build and push
|
|
|
|
id: docker_build
|
2020-10-03 22:44:16 +02:00
|
|
|
uses: ./action
|
2020-09-22 20:53:40 +02:00
|
|
|
with:
|
|
|
|
file: ./test/Dockerfile
|
|
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
push: true
|
|
|
|
tags: |
|
|
|
|
localhost:5000/name/app:latest
|
|
|
|
localhost:5000/name/app:1.0.0
|
|
|
|
-
|
|
|
|
name: Inspect
|
|
|
|
run: |
|
2023-01-11 14:03:02 +01:00
|
|
|
docker buildx imagetools inspect localhost:5000/name/app:1.0.0 --format '{{json .}}'
|
2020-10-21 09:51:06 +02:00
|
|
|
-
|
|
|
|
name: Check digest
|
|
|
|
run: |
|
|
|
|
if [ -z "${{ steps.docker_build.outputs.digest }}" ]; then
|
|
|
|
echo "::error::Digest should not be empty"
|
|
|
|
exit 1
|
|
|
|
fi
|
2020-09-22 20:53:40 +02:00
|
|
|
|
|
|
|
git-context-secret:
|
|
|
|
runs-on: ubuntu-latest
|
2020-09-05 05:18:15 +02:00
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
2020-08-17 22:18:15 +02:00
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-02 12:03:44 +01:00
|
|
|
uses: actions/checkout@v3
|
2020-10-03 22:44:16 +02:00
|
|
|
with:
|
|
|
|
path: action
|
2020-08-17 22:18:15 +02:00
|
|
|
-
|
|
|
|
name: Set up QEMU
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2020-08-17 22:18:15 +02:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
|
|
|
id: buildx
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2020-08-17 22:18:15 +02:00
|
|
|
with:
|
2022-08-17 02:17:37 +02:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-08-12 16:45:35 +02:00
|
|
|
driver-opts: |
|
|
|
|
network=host
|
2022-08-17 02:17:37 +02:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2020-08-17 22:18:15 +02:00
|
|
|
-
|
|
|
|
name: Build and push
|
|
|
|
id: docker_build
|
2020-10-03 22:44:16 +02:00
|
|
|
uses: ./action
|
2020-08-17 22:18:15 +02:00
|
|
|
with:
|
|
|
|
file: ./test/Dockerfile
|
|
|
|
builder: ${{ steps.buildx.outputs.name }}
|
2020-09-02 10:07:11 +02:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2020-08-17 22:18:15 +02:00
|
|
|
push: true
|
|
|
|
tags: |
|
|
|
|
localhost:5000/name/app:latest
|
|
|
|
localhost:5000/name/app:1.0.0
|
2020-09-02 10:07:11 +02:00
|
|
|
secrets: |
|
2020-09-23 11:04:40 +02:00
|
|
|
GIT_AUTH_TOKEN=${{ github.token }}
|
2020-11-17 21:38:45 +01:00
|
|
|
"MYSECRET=aaaaaaaa
|
|
|
|
bbbbbbb
|
|
|
|
ccccccccc"
|
|
|
|
FOO=bar
|
|
|
|
"EMPTYLINE=aaaa
|
|
|
|
|
|
|
|
bbbb
|
|
|
|
ccc"
|
2020-08-17 22:18:15 +02:00
|
|
|
-
|
|
|
|
name: Inspect
|
|
|
|
run: |
|
2023-01-11 14:03:02 +01:00
|
|
|
docker buildx imagetools inspect localhost:5000/name/app:1.0.0 --format '{{json .}}'
|
2020-10-21 09:51:06 +02:00
|
|
|
-
|
|
|
|
name: Check digest
|
|
|
|
run: |
|
|
|
|
if [ -z "${{ steps.docker_build.outputs.digest }}" ]; then
|
|
|
|
echo "::error::Digest should not be empty"
|
|
|
|
exit 1
|
|
|
|
fi
|
2020-08-17 22:18:15 +02:00
|
|
|
|
2020-09-02 10:07:11 +02:00
|
|
|
path-context:
|
2020-08-16 00:36:41 +02:00
|
|
|
runs-on: ubuntu-latest
|
2020-09-05 05:18:15 +02:00
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
2020-08-16 00:36:41 +02:00
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-02 12:03:44 +01:00
|
|
|
uses: actions/checkout@v3
|
2020-08-16 00:36:41 +02:00
|
|
|
-
|
|
|
|
name: Set up QEMU
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2020-08-16 00:36:41 +02:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
|
|
|
id: buildx
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2020-08-17 02:33:38 +02:00
|
|
|
with:
|
2022-08-17 02:17:37 +02:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-08-12 16:45:35 +02:00
|
|
|
driver-opts: |
|
|
|
|
network=host
|
2022-08-17 02:17:37 +02:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2020-08-16 00:36:41 +02:00
|
|
|
-
|
|
|
|
name: Build and push
|
2020-08-23 04:07:29 +02:00
|
|
|
id: docker_build
|
2020-08-16 00:36:41 +02:00
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
2020-09-02 10:07:11 +02:00
|
|
|
file: ./test/Dockerfile
|
2020-08-16 03:21:48 +02:00
|
|
|
builder: ${{ steps.buildx.outputs.name }}
|
2020-08-17 02:33:38 +02:00
|
|
|
push: true
|
2020-08-16 00:36:41 +02:00
|
|
|
tags: |
|
|
|
|
localhost:5000/name/app:latest
|
|
|
|
localhost:5000/name/app:1.0.0
|
2020-08-17 02:42:46 +02:00
|
|
|
-
|
|
|
|
name: Inspect
|
|
|
|
run: |
|
2023-01-11 14:03:02 +01:00
|
|
|
docker buildx imagetools inspect localhost:5000/name/app:1.0.0 --format '{{json .}}'
|
2020-10-21 02:46:41 +02:00
|
|
|
-
|
|
|
|
name: Check digest
|
|
|
|
run: |
|
|
|
|
if [ -z "${{ steps.docker_build.outputs.digest }}" ]; then
|
|
|
|
echo "::error::Digest should not be empty"
|
|
|
|
exit 1
|
|
|
|
fi
|
2020-08-16 17:18:08 +02:00
|
|
|
|
2020-10-21 21:07:52 +02:00
|
|
|
error:
|
2021-04-27 16:16:22 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-02 12:03:44 +01:00
|
|
|
uses: actions/checkout@v3
|
2021-04-27 16:16:22 +02:00
|
|
|
-
|
|
|
|
name: Stop docker
|
|
|
|
run: |
|
|
|
|
sudo systemctl stop docker
|
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
id: docker_build
|
|
|
|
continue-on-error: true
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/Dockerfile
|
|
|
|
-
|
|
|
|
name: Check
|
|
|
|
run: |
|
|
|
|
echo "${{ toJson(steps.docker_build) }}"
|
|
|
|
if [ "${{ steps.docker_build.outcome }}" != "failure" ] || [ "${{ steps.docker_build.conclusion }}" != "success" ]; then
|
|
|
|
echo "::error::Should have failed"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
error-buildx:
|
2020-10-21 21:07:52 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-02 12:03:44 +01:00
|
|
|
uses: actions/checkout@v3
|
2020-10-21 21:07:52 +02:00
|
|
|
-
|
|
|
|
name: Set up QEMU
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2020-10-21 21:07:52 +02:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2022-08-12 16:45:35 +02:00
|
|
|
with:
|
2022-08-17 02:17:37 +02:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-08-12 16:45:35 +02:00
|
|
|
driver-opts: |
|
2022-08-17 02:17:37 +02:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2020-10-21 21:07:52 +02:00
|
|
|
-
|
|
|
|
name: Build
|
2020-10-23 00:38:26 +02:00
|
|
|
id: docker_build
|
2020-10-21 21:07:52 +02:00
|
|
|
continue-on-error: true
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/Dockerfile
|
|
|
|
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x
|
|
|
|
push: true
|
|
|
|
tags: localhost:5000/name/app:latest
|
2020-10-23 00:38:26 +02:00
|
|
|
-
|
|
|
|
name: Check
|
|
|
|
run: |
|
|
|
|
echo "${{ toJson(steps.docker_build) }}"
|
|
|
|
if [ "${{ steps.docker_build.outcome }}" != "failure" ] || [ "${{ steps.docker_build.conclusion }}" != "success" ]; then
|
|
|
|
echo "::error::Should have failed"
|
|
|
|
exit 1
|
|
|
|
fi
|
2020-10-21 21:07:52 +02:00
|
|
|
|
|
|
|
docker-driver:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-02 12:03:44 +01:00
|
|
|
uses: actions/checkout@v3
|
2020-10-21 21:07:52 +02:00
|
|
|
-
|
|
|
|
name: Build
|
2020-10-23 00:38:26 +02:00
|
|
|
id: docker_build
|
2020-10-21 21:07:52 +02:00
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/Dockerfile
|
2021-01-15 19:21:19 +01:00
|
|
|
push: true
|
2020-10-21 21:07:52 +02:00
|
|
|
tags: localhost:5000/name/app:latest
|
|
|
|
|
2020-10-22 21:50:22 +02:00
|
|
|
export-docker:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-02 12:03:44 +01:00
|
|
|
uses: actions/checkout@v3
|
2020-10-22 21:50:22 +02:00
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/Dockerfile
|
|
|
|
load: true
|
|
|
|
tags: myimage:latest
|
|
|
|
-
|
|
|
|
name: Inspect
|
|
|
|
run: |
|
|
|
|
docker image inspect myimage:latest
|
|
|
|
|
2022-10-09 17:39:54 +02:00
|
|
|
secret:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
with:
|
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
|
|
|
driver-opts: |
|
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: ./test/secret.Dockerfile
|
|
|
|
secrets: |
|
|
|
|
MYSECRET=foo
|
|
|
|
INVALID_SECRET=
|
|
|
|
|
2021-04-06 14:49:15 +02:00
|
|
|
network:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-02 12:03:44 +01:00
|
|
|
uses: actions/checkout@v3
|
2021-04-06 14:49:15 +02:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2022-08-12 16:45:35 +02:00
|
|
|
with:
|
2022-08-17 02:17:37 +02:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-08-12 16:45:35 +02:00
|
|
|
driver-opts: |
|
2022-08-17 02:17:37 +02:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2021-04-06 14:49:15 +02:00
|
|
|
-
|
|
|
|
name: List networks
|
|
|
|
run: docker network ls
|
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
tags: name/app:latest
|
|
|
|
network: host
|
|
|
|
|
2021-11-16 07:19:27 +01:00
|
|
|
shm-size:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-02 12:03:44 +01:00
|
|
|
uses: actions/checkout@v3
|
2021-11-16 07:19:27 +01:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2021-11-16 07:19:27 +01:00
|
|
|
with:
|
2022-08-17 02:17:37 +02:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2021-11-16 07:19:27 +01:00
|
|
|
driver-opts: |
|
2022-08-17 02:17:37 +02:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2021-11-16 07:19:27 +01:00
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/shmsize.Dockerfile
|
|
|
|
tags: name/app:latest
|
|
|
|
shm-size: 2g
|
|
|
|
|
|
|
|
ulimit:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-02 12:03:44 +01:00
|
|
|
uses: actions/checkout@v3
|
2021-11-16 07:19:27 +01:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2021-11-16 07:19:27 +01:00
|
|
|
with:
|
2022-08-17 02:17:37 +02:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2021-11-16 07:19:27 +01:00
|
|
|
driver-opts: |
|
2022-08-12 16:45:35 +02:00
|
|
|
network=host
|
2022-08-17 02:17:37 +02:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2021-11-16 07:19:27 +01:00
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/ulimit.Dockerfile
|
|
|
|
tags: name/app:latest
|
|
|
|
ulimit: |
|
|
|
|
nofile=1024:1024
|
|
|
|
nproc=3
|
|
|
|
|
|
|
|
cgroup-parent:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-02 12:03:44 +01:00
|
|
|
uses: actions/checkout@v3
|
2021-11-16 07:19:27 +01:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2021-11-16 07:19:27 +01:00
|
|
|
with:
|
2022-08-17 02:17:37 +02:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2021-11-16 07:19:27 +01:00
|
|
|
driver-opts: |
|
2022-08-12 16:45:35 +02:00
|
|
|
network=host
|
2022-08-17 02:17:37 +02:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2021-11-16 07:19:27 +01:00
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/cgroup.Dockerfile
|
|
|
|
tags: name/app:latest
|
|
|
|
cgroup-parent: foo
|
|
|
|
|
2022-01-31 11:47:45 +01:00
|
|
|
add-hosts:
|
2022-01-30 18:33:31 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-02 12:03:44 +01:00
|
|
|
uses: actions/checkout@v3
|
2022-01-30 18:33:31 +01:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2022-08-12 16:45:35 +02:00
|
|
|
with:
|
2022-08-17 02:17:37 +02:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-08-12 16:45:35 +02:00
|
|
|
driver-opts: |
|
|
|
|
network=host
|
2022-08-17 02:17:37 +02:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2022-01-30 18:33:31 +01:00
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/addhost.Dockerfile
|
|
|
|
tags: name/app:latest
|
2022-01-31 11:47:45 +01:00
|
|
|
add-hosts: |
|
2022-01-30 18:33:31 +01:00
|
|
|
docker:10.180.0.1
|
|
|
|
foo:10.0.0.1
|
|
|
|
|
2022-03-14 20:09:10 +01:00
|
|
|
build-contexts:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-05-28 18:36:30 +02:00
|
|
|
uses: actions/checkout@v3
|
2022-03-14 20:09:10 +01:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2022-08-12 16:45:35 +02:00
|
|
|
with:
|
2022-08-17 02:17:37 +02:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-08-12 16:45:35 +02:00
|
|
|
driver-opts: |
|
2022-08-17 02:17:37 +02:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2022-03-14 20:09:10 +01:00
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/buildcontext.Dockerfile
|
|
|
|
build-contexts: |
|
|
|
|
alpine=docker-image://debian:stable-slim
|
|
|
|
tags: name/app:latest
|
|
|
|
|
2022-07-18 17:24:11 +02:00
|
|
|
no-cache-filters:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v2
|
2022-08-12 16:45:35 +02:00
|
|
|
with:
|
2022-08-17 02:17:37 +02:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-08-12 16:45:35 +02:00
|
|
|
driver-opts: |
|
2022-08-17 02:17:37 +02:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2022-07-18 17:24:11 +02:00
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/nocachefilter.Dockerfile
|
|
|
|
no-cache-filters: build
|
|
|
|
tags: name/app:latest
|
|
|
|
cache-from: type=gha,scope=nocachefilter
|
|
|
|
cache-to: type=gha,scope=nocachefilter,mode=max
|
|
|
|
|
2023-01-11 12:12:09 +01:00
|
|
|
attests:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- target: image
|
|
|
|
output: type=image,name=localhost:5000/name/app:latest,push=true
|
|
|
|
- target: binary
|
|
|
|
output: /tmp/buildx-build
|
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
|
|
|
env:
|
|
|
|
BUILDX_VERSION: v0.10.0-rc2 # TODO: remove when Buildx v0.10.0 is released
|
|
|
|
BUILDKIT_IMAGE: moby/buildkit:v0.11.0-rc3 # TODO: remove when BuildKit v0.11.0 is released
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
with:
|
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
|
|
|
driver-opts: |
|
|
|
|
network=host
|
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test/go
|
|
|
|
file: ./test/go/Dockerfile
|
|
|
|
target: ${{ matrix.target }}
|
|
|
|
outputs: ${{ matrix.output }}
|
2022-12-20 06:17:29 +01:00
|
|
|
sbom: true
|
2023-01-11 12:12:09 +01:00
|
|
|
cache-from: type=gha,scope=attests-${{ matrix.target }}
|
|
|
|
cache-to: type=gha,scope=attests-${{ matrix.target }},mode=max
|
|
|
|
-
|
|
|
|
name: Inspect image
|
|
|
|
if: matrix.target == 'image'
|
|
|
|
run: |
|
2023-01-11 14:03:02 +01:00
|
|
|
docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}'
|
2023-01-11 12:12:09 +01:00
|
|
|
-
|
|
|
|
name: Check output folder
|
|
|
|
if: matrix.target == 'binary'
|
|
|
|
run: |
|
|
|
|
tree /tmp/buildx-build
|
|
|
|
-
|
|
|
|
name: Print provenance
|
|
|
|
if: matrix.target == 'binary'
|
|
|
|
run: |
|
|
|
|
cat /tmp/buildx-build/provenance.json | jq
|
|
|
|
-
|
|
|
|
name: Print SBOM
|
|
|
|
if: matrix.target == 'binary'
|
|
|
|
run: |
|
|
|
|
cat /tmp/buildx-build/sbom.spdx.json | jq
|
|
|
|
|
2020-09-02 10:07:11 +02:00
|
|
|
multi:
|
2020-08-29 16:10:05 +02:00
|
|
|
runs-on: ubuntu-latest
|
2020-09-02 10:07:11 +02:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
dockerfile:
|
|
|
|
- multi
|
|
|
|
- multi-sudo
|
2020-09-05 05:18:15 +02:00
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
2020-08-29 16:10:05 +02:00
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-02 12:03:44 +01:00
|
|
|
uses: actions/checkout@v3
|
2020-08-29 16:10:05 +02:00
|
|
|
-
|
|
|
|
name: Set up QEMU
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2020-08-29 16:10:05 +02:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
|
|
|
id: buildx
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2020-08-29 16:10:05 +02:00
|
|
|
with:
|
2022-08-17 02:17:37 +02:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-08-12 16:45:35 +02:00
|
|
|
driver-opts: |
|
|
|
|
network=host
|
2022-08-17 02:17:37 +02:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2020-08-29 16:10:05 +02:00
|
|
|
-
|
|
|
|
name: Build and push
|
|
|
|
id: docker_build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
2021-03-28 16:43:51 +02:00
|
|
|
file: ./test/${{ matrix.dockerfile }}.Dockerfile
|
2020-08-29 16:10:05 +02:00
|
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
push: true
|
|
|
|
tags: |
|
|
|
|
localhost:5000/name/app:latest
|
|
|
|
localhost:5000/name/app:1.0.0
|
|
|
|
-
|
|
|
|
name: Inspect
|
|
|
|
run: |
|
2023-01-11 14:03:02 +01:00
|
|
|
docker buildx imagetools inspect localhost:5000/name/app:1.0.0 --format '{{json .}}'
|
2020-10-21 09:51:06 +02:00
|
|
|
-
|
|
|
|
name: Check digest
|
|
|
|
run: |
|
|
|
|
if [ -z "${{ steps.docker_build.outputs.digest }}" ]; then
|
|
|
|
echo "::error::Digest should not be empty"
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-03-14 19:30:50 +01:00
|
|
|
|
|
|
|
digest:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
DOCKER_IMAGE: localhost:5000/name/app
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
driver:
|
|
|
|
- docker
|
|
|
|
- docker-container
|
|
|
|
load:
|
|
|
|
- true
|
|
|
|
- false
|
|
|
|
push:
|
|
|
|
- true
|
|
|
|
- false
|
|
|
|
exclude:
|
|
|
|
- driver: docker
|
|
|
|
load: true
|
|
|
|
push: true
|
|
|
|
- driver: docker-container
|
|
|
|
load: true
|
|
|
|
push: true
|
|
|
|
- driver: docker
|
|
|
|
load: false
|
|
|
|
push: false
|
|
|
|
- driver: docker-container
|
|
|
|
load: false
|
|
|
|
push: false
|
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-05-28 18:36:30 +02:00
|
|
|
uses: actions/checkout@v3
|
2020-08-29 16:10:05 +02:00
|
|
|
-
|
2022-03-14 19:30:50 +01:00
|
|
|
name: Set up Docker Buildx
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2022-03-14 19:30:50 +01:00
|
|
|
with:
|
2022-08-17 02:17:37 +02:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-03-14 19:30:50 +01:00
|
|
|
driver: ${{ matrix.driver }}
|
|
|
|
driver-opts: |
|
|
|
|
network=host
|
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
id: docker_build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
load: ${{ matrix.load }}
|
|
|
|
push: ${{ matrix.push }}
|
|
|
|
tags: ${{ env.DOCKER_IMAGE }}:latest
|
|
|
|
platforms: ${{ matrix.platforms }}
|
|
|
|
-
|
|
|
|
name: Docker images
|
|
|
|
run: |
|
|
|
|
docker image ls --no-trunc
|
|
|
|
-
|
|
|
|
name: Check digest
|
|
|
|
if: ${{ matrix.push }}
|
|
|
|
run: |
|
|
|
|
if [ -z "${{ steps.docker_build.outputs.digest }}" ]; then
|
|
|
|
echo "::error::Digest should not be empty"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
-
|
|
|
|
name: Check manifest
|
|
|
|
if: ${{ matrix.push }}
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}@${{ steps.docker_build.outputs.digest }} --format '{{json .}}'
|
|
|
|
-
|
|
|
|
name: Check image ID
|
|
|
|
run: |
|
|
|
|
if [ -z "${{ steps.docker_build.outputs.imageid }}" ]; then
|
|
|
|
echo "::error::Image ID should not be empty"
|
|
|
|
exit 1
|
|
|
|
fi
|
2020-08-29 16:10:05 +02:00
|
|
|
-
|
2022-03-14 19:30:50 +01:00
|
|
|
name: Inspect image
|
|
|
|
if: ${{ matrix.load }}
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
docker image inspect ${{ steps.docker_build.outputs.imageid }}
|
2020-08-29 16:10:05 +02:00
|
|
|
|
2020-10-04 00:01:14 +02:00
|
|
|
registry-cache:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-02 12:03:44 +01:00
|
|
|
uses: actions/checkout@v3
|
2020-10-04 00:01:14 +02:00
|
|
|
-
|
|
|
|
name: Set up QEMU
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2020-10-04 00:01:14 +02:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
|
|
|
id: buildx
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2020-10-04 00:01:14 +02:00
|
|
|
with:
|
2022-08-17 02:17:37 +02:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2020-10-11 19:17:08 +02:00
|
|
|
driver-opts: |
|
|
|
|
network=host
|
2022-08-17 02:17:37 +02:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2020-10-04 00:01:14 +02:00
|
|
|
-
|
|
|
|
name: Build and push (1)
|
|
|
|
id: docker_build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
2021-03-28 16:43:51 +02:00
|
|
|
file: ./test/multi.Dockerfile
|
2020-10-04 00:01:14 +02:00
|
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
push: true
|
|
|
|
tags: |
|
|
|
|
localhost:5000/name/app:latest
|
|
|
|
localhost:5000/name/app:1.0.0
|
2020-10-04 01:10:42 +02:00
|
|
|
cache-from: type=registry,ref=localhost:5000/name/app
|
|
|
|
cache-to: type=inline
|
2020-10-04 00:01:14 +02:00
|
|
|
-
|
|
|
|
name: Inspect (1)
|
|
|
|
run: |
|
2023-01-11 14:03:02 +01:00
|
|
|
docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}'
|
2020-10-21 09:51:06 +02:00
|
|
|
-
|
|
|
|
name: Check digest (1)
|
|
|
|
run: |
|
|
|
|
if [ -z "${{ steps.docker_build.outputs.digest }}" ]; then
|
|
|
|
echo "::error::Digest should not be empty"
|
|
|
|
exit 1
|
|
|
|
fi
|
2020-10-04 00:01:14 +02:00
|
|
|
-
|
|
|
|
name: Prune
|
|
|
|
run: |
|
|
|
|
docker buildx prune -a -f --verbose
|
|
|
|
-
|
|
|
|
name: Build and push (2)
|
|
|
|
id: docker_build2
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
2021-03-28 16:43:51 +02:00
|
|
|
file: ./test/multi.Dockerfile
|
2020-10-04 00:01:14 +02:00
|
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
push: true
|
|
|
|
tags: |
|
|
|
|
localhost:5000/name/app:latest
|
|
|
|
localhost:5000/name/app:1.0.0
|
2020-10-04 01:10:42 +02:00
|
|
|
cache-from: type=registry,ref=localhost:5000/name/app
|
|
|
|
cache-to: type=inline
|
2020-10-04 00:01:14 +02:00
|
|
|
-
|
|
|
|
name: Inspect (2)
|
|
|
|
run: |
|
2023-01-11 14:03:02 +01:00
|
|
|
docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}'
|
2020-10-04 00:01:14 +02:00
|
|
|
-
|
2020-10-21 09:51:06 +02:00
|
|
|
name: Check digest (2)
|
|
|
|
run: |
|
|
|
|
if [ -z "${{ steps.docker_build2.outputs.digest }}" ]; then
|
|
|
|
echo "::error::Digest should not be empty"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
-
|
|
|
|
name: Compare digests
|
2020-10-04 00:01:14 +02:00
|
|
|
run: |
|
|
|
|
echo Compare "${{ steps.docker_build.outputs.digest }}" with "${{ steps.docker_build2.outputs.digest }}"
|
|
|
|
if [ "${{ steps.docker_build.outputs.digest }}" != "${{ steps.docker_build2.outputs.digest }}" ]; then
|
|
|
|
echo "::error::Digests should be identical"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-07-29 16:57:22 +02:00
|
|
|
github-cache:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-02 12:03:44 +01:00
|
|
|
uses: actions/checkout@v3
|
2021-07-29 16:57:22 +02:00
|
|
|
-
|
|
|
|
name: Set up QEMU
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2021-07-29 16:57:22 +02:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2021-07-29 16:57:22 +02:00
|
|
|
with:
|
2022-08-17 02:17:37 +02:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2021-07-29 16:57:22 +02:00
|
|
|
driver-opts: |
|
|
|
|
network=host
|
2022-08-17 02:17:37 +02:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2021-07-29 16:57:22 +02:00
|
|
|
buildkitd-flags: --debug
|
|
|
|
-
|
|
|
|
name: Build and push
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/multi.Dockerfile
|
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
push: true
|
|
|
|
tags: |
|
|
|
|
localhost:5000/name/app:latest
|
|
|
|
localhost:5000/name/app:1.0.0
|
|
|
|
cache-from: type=gha,scope=ci-${{ matrix.buildx_version }}
|
|
|
|
cache-to: type=gha,scope=ci-${{ matrix.buildx_version }}
|
|
|
|
-
|
|
|
|
name: Inspect
|
|
|
|
run: |
|
2023-01-11 14:03:02 +01:00
|
|
|
docker buildx imagetools inspect localhost:5000/name/app:1.0.0 --format '{{json .}}'
|
2022-04-28 09:31:47 +02:00
|
|
|
|
|
|
|
standalone:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
-
|
|
|
|
name: Uninstall moby cli
|
|
|
|
run: |
|
|
|
|
sudo apt-get purge -y moby-cli moby-buildx
|
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2022-05-05 19:24:32 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2022-08-12 16:45:35 +02:00
|
|
|
with:
|
2022-08-17 02:17:37 +02:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-08-12 16:45:35 +02:00
|
|
|
driver-opts: |
|
|
|
|
network=host
|
2022-08-17 02:17:37 +02:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2022-04-28 09:31:47 +02:00
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/Dockerfile
|