2020-08-15 18:36:41 -04:00
|
|
|
name: ci
|
|
|
|
|
2023-09-05 04:59:10 -04:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2020-08-15 18:36:41 -04:00
|
|
|
on:
|
2020-10-22 18:38:26 -04:00
|
|
|
workflow_dispatch:
|
2022-08-12 10:45:35 -04: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
|
2023-02-20 16:54:11 -05:00
|
|
|
schedule:
|
|
|
|
- cron: '0 10 * * *'
|
2020-08-15 18:36:41 -04:00
|
|
|
push:
|
2020-09-12 14:53:25 -04:00
|
|
|
branches:
|
2022-01-18 08:57:27 -05:00
|
|
|
- 'master'
|
2023-02-20 16:54:11 -05:00
|
|
|
- 'releases/v*'
|
2020-08-15 18:36:41 -04:00
|
|
|
pull_request:
|
|
|
|
|
2022-08-16 20:17:37 -04:00
|
|
|
env:
|
|
|
|
BUILDX_VERSION: latest
|
|
|
|
BUILDKIT_IMAGE: moby/buildkit:buildx-stable-1
|
|
|
|
|
2020-08-15 18:36:41 -04:00
|
|
|
jobs:
|
2020-10-19 16:17:35 -04:00
|
|
|
minimal:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2020-10-19 16:17:35 -04:00
|
|
|
with:
|
|
|
|
path: action
|
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2022-08-12 10:45:35 -04:00
|
|
|
with:
|
2022-08-16 20:17:37 -04:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-08-12 10:45:35 -04:00
|
|
|
driver-opts: |
|
2022-08-16 20:17:37 -04:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2020-10-19 16:17:35 -04:00
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./action
|
|
|
|
with:
|
|
|
|
file: ./test/Dockerfile
|
|
|
|
|
2020-09-02 04:07:11 -04:00
|
|
|
git-context:
|
2020-08-17 16:18:15 -04:00
|
|
|
runs-on: ubuntu-latest
|
2020-09-22 14:53:40 -04:00
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2020-10-03 16:44:16 -04:00
|
|
|
with:
|
|
|
|
path: action
|
2020-09-22 14:53:40 -04:00
|
|
|
-
|
|
|
|
name: Set up QEMU
|
2023-09-12 07:17:07 -04:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2020-09-22 14:53:40 -04:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
|
|
|
id: buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2020-09-22 14:53:40 -04:00
|
|
|
with:
|
2022-08-16 20:17:37 -04:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-08-12 10:45:35 -04:00
|
|
|
driver-opts: |
|
|
|
|
network=host
|
2022-08-16 20:17:37 -04:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2020-09-22 14:53:40 -04:00
|
|
|
-
|
|
|
|
name: Build and push
|
|
|
|
id: docker_build
|
2020-10-03 16:44:16 -04:00
|
|
|
uses: ./action
|
2020-09-22 14:53:40 -04: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 08:03:02 -05:00
|
|
|
docker buildx imagetools inspect localhost:5000/name/app:1.0.0 --format '{{json .}}'
|
2020-10-21 03:51:06 -04: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 14:53:40 -04:00
|
|
|
|
|
|
|
git-context-secret:
|
|
|
|
runs-on: ubuntu-latest
|
2020-09-04 23:18:15 -04:00
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
2020-08-17 16:18:15 -04:00
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2020-10-03 16:44:16 -04:00
|
|
|
with:
|
|
|
|
path: action
|
2020-08-17 16:18:15 -04:00
|
|
|
-
|
|
|
|
name: Set up QEMU
|
2023-09-12 07:17:07 -04:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2020-08-17 16:18:15 -04:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
|
|
|
id: buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2020-08-17 16:18:15 -04:00
|
|
|
with:
|
2022-08-16 20:17:37 -04:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-08-12 10:45:35 -04:00
|
|
|
driver-opts: |
|
|
|
|
network=host
|
2022-08-16 20:17:37 -04:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2020-08-17 16:18:15 -04:00
|
|
|
-
|
|
|
|
name: Build and push
|
|
|
|
id: docker_build
|
2020-10-03 16:44:16 -04:00
|
|
|
uses: ./action
|
2020-08-17 16:18:15 -04:00
|
|
|
with:
|
|
|
|
file: ./test/Dockerfile
|
|
|
|
builder: ${{ steps.buildx.outputs.name }}
|
2020-09-02 04:07:11 -04:00
|
|
|
platforms: linux/amd64,linux/arm64
|
2020-08-17 16:18:15 -04:00
|
|
|
push: true
|
|
|
|
tags: |
|
|
|
|
localhost:5000/name/app:latest
|
|
|
|
localhost:5000/name/app:1.0.0
|
2020-09-02 04:07:11 -04:00
|
|
|
secrets: |
|
2020-09-23 05:04:40 -04:00
|
|
|
GIT_AUTH_TOKEN=${{ github.token }}
|
2020-11-17 15:38:45 -05:00
|
|
|
"MYSECRET=aaaaaaaa
|
|
|
|
bbbbbbb
|
|
|
|
ccccccccc"
|
|
|
|
FOO=bar
|
|
|
|
"EMPTYLINE=aaaa
|
|
|
|
|
|
|
|
bbbb
|
|
|
|
ccc"
|
2020-08-17 16:18:15 -04:00
|
|
|
-
|
|
|
|
name: Inspect
|
|
|
|
run: |
|
2023-01-11 08:03:02 -05:00
|
|
|
docker buildx imagetools inspect localhost:5000/name/app:1.0.0 --format '{{json .}}'
|
2020-10-21 03:51:06 -04: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 16:18:15 -04:00
|
|
|
|
2020-09-02 04:07:11 -04:00
|
|
|
path-context:
|
2020-08-15 18:36:41 -04:00
|
|
|
runs-on: ubuntu-latest
|
2020-09-04 23:18:15 -04:00
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
2020-08-15 18:36:41 -04:00
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2020-08-15 18:36:41 -04:00
|
|
|
-
|
|
|
|
name: Set up QEMU
|
2023-09-12 07:17:07 -04:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2020-08-15 18:36:41 -04:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
|
|
|
id: buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2020-08-16 20:33:38 -04:00
|
|
|
with:
|
2022-08-16 20:17:37 -04:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-08-12 10:45:35 -04:00
|
|
|
driver-opts: |
|
|
|
|
network=host
|
2022-08-16 20:17:37 -04:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2020-08-15 18:36:41 -04:00
|
|
|
-
|
|
|
|
name: Build and push
|
2020-08-22 22:07:29 -04:00
|
|
|
id: docker_build
|
2020-08-15 18:36:41 -04:00
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
2020-09-02 04:07:11 -04:00
|
|
|
file: ./test/Dockerfile
|
2020-08-15 21:21:48 -04:00
|
|
|
builder: ${{ steps.buildx.outputs.name }}
|
2020-08-16 20:33:38 -04:00
|
|
|
push: true
|
2020-08-15 18:36:41 -04:00
|
|
|
tags: |
|
|
|
|
localhost:5000/name/app:latest
|
|
|
|
localhost:5000/name/app:1.0.0
|
2020-08-16 20:42:46 -04:00
|
|
|
-
|
|
|
|
name: Inspect
|
|
|
|
run: |
|
2023-01-11 08:03:02 -05:00
|
|
|
docker buildx imagetools inspect localhost:5000/name/app:1.0.0 --format '{{json .}}'
|
2020-10-20 20:46:41 -04: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 11:18:08 -04:00
|
|
|
|
2023-02-20 16:59:45 -05:00
|
|
|
example:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
DOCKER_IMAGE: localhost:5000/name/app
|
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2023-02-20 16:59:45 -05:00
|
|
|
-
|
|
|
|
name: Docker meta
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v4
|
|
|
|
with:
|
|
|
|
images: ${{ env.DOCKER_IMAGE }}
|
|
|
|
tags: |
|
|
|
|
type=schedule
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=pr
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
type=semver,pattern={{major}}
|
|
|
|
type=sha
|
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2023-02-20 16:59:45 -05:00
|
|
|
with:
|
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
|
|
|
driver-opts: |
|
|
|
|
network=host
|
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
|
|
|
-
|
|
|
|
name: Build and export to Docker client
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/Dockerfile
|
|
|
|
load: true
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
-
|
|
|
|
name: Build and push to local registry
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/Dockerfile
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
-
|
|
|
|
name: Inspect image
|
|
|
|
run: |
|
|
|
|
docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }}
|
|
|
|
-
|
|
|
|
name: Check manifest
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
run: |
|
|
|
|
docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }} --format '{{json .}}'
|
|
|
|
|
2020-10-21 15:07:52 -04:00
|
|
|
error:
|
2021-04-27 10:16:22 -04:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2021-04-27 10:16:22 -04:00
|
|
|
-
|
|
|
|
name: Stop docker
|
|
|
|
run: |
|
2023-09-05 03:26:58 -04:00
|
|
|
sudo systemctl stop docker docker.socket
|
2021-04-27 10:16:22 -04:00
|
|
|
-
|
|
|
|
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 15:07:52 -04:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2020-10-21 15:07:52 -04:00
|
|
|
-
|
|
|
|
name: Set up QEMU
|
2023-09-12 07:17:07 -04:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2020-10-21 15:07:52 -04:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2022-08-12 10:45:35 -04:00
|
|
|
with:
|
2022-08-16 20:17:37 -04:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-08-12 10:45:35 -04:00
|
|
|
driver-opts: |
|
2022-08-16 20:17:37 -04:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2020-10-21 15:07:52 -04:00
|
|
|
-
|
|
|
|
name: Build
|
2020-10-22 18:38:26 -04:00
|
|
|
id: docker_build
|
2020-10-21 15:07:52 -04: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-22 18:38:26 -04: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 15:07:52 -04:00
|
|
|
|
|
|
|
docker-driver:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2020-10-21 15:07:52 -04:00
|
|
|
-
|
|
|
|
name: Build
|
2020-10-22 18:38:26 -04:00
|
|
|
id: docker_build
|
2020-10-21 15:07:52 -04:00
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/Dockerfile
|
2021-01-15 13:21:19 -05:00
|
|
|
push: true
|
2020-10-21 15:07:52 -04:00
|
|
|
tags: localhost:5000/name/app:latest
|
|
|
|
|
2020-10-22 15:50:22 -04:00
|
|
|
export-docker:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2020-10-22 15:50:22 -04: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 11:39:54 -04:00
|
|
|
secret:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2022-10-09 11:39:54 -04:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2022-10-09 11:39:54 -04:00
|
|
|
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 08:49:15 -04:00
|
|
|
network:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2021-04-06 08:49:15 -04:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2022-08-12 10:45:35 -04:00
|
|
|
with:
|
2022-08-16 20:17:37 -04:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-08-12 10:45:35 -04:00
|
|
|
driver-opts: |
|
2022-08-16 20:17:37 -04:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2021-04-06 08:49:15 -04:00
|
|
|
-
|
|
|
|
name: List networks
|
|
|
|
run: docker network ls
|
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
tags: name/app:latest
|
|
|
|
network: host
|
|
|
|
|
2021-11-16 01:19:27 -05:00
|
|
|
shm-size:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2021-11-16 01:19:27 -05:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2021-11-16 01:19:27 -05:00
|
|
|
with:
|
2022-08-16 20:17:37 -04:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2021-11-16 01:19:27 -05:00
|
|
|
driver-opts: |
|
2022-08-16 20:17:37 -04:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2021-11-16 01:19:27 -05: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
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2021-11-16 01:19:27 -05:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2021-11-16 01:19:27 -05:00
|
|
|
with:
|
2022-08-16 20:17:37 -04:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2021-11-16 01:19:27 -05:00
|
|
|
driver-opts: |
|
2022-08-12 10:45:35 -04:00
|
|
|
network=host
|
2022-08-16 20:17:37 -04:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2021-11-16 01:19:27 -05: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
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2021-11-16 01:19:27 -05:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2021-11-16 01:19:27 -05:00
|
|
|
with:
|
2022-08-16 20:17:37 -04:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2021-11-16 01:19:27 -05:00
|
|
|
driver-opts: |
|
2022-08-12 10:45:35 -04:00
|
|
|
network=host
|
2022-08-16 20:17:37 -04:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2021-11-16 01:19:27 -05:00
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/cgroup.Dockerfile
|
|
|
|
tags: name/app:latest
|
|
|
|
cgroup-parent: foo
|
|
|
|
|
2022-01-31 05:47:45 -05:00
|
|
|
add-hosts:
|
2022-01-30 12:33:31 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2022-01-30 12:33:31 -05:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2022-08-12 10:45:35 -04:00
|
|
|
with:
|
2022-08-16 20:17:37 -04:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-08-12 10:45:35 -04:00
|
|
|
driver-opts: |
|
|
|
|
network=host
|
2022-08-16 20:17:37 -04:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2022-01-30 12:33:31 -05:00
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/addhost.Dockerfile
|
|
|
|
tags: name/app:latest
|
2022-01-31 05:47:45 -05:00
|
|
|
add-hosts: |
|
2022-01-30 12:33:31 -05:00
|
|
|
docker:10.180.0.1
|
|
|
|
foo:10.0.0.1
|
|
|
|
|
2022-07-18 11:24:11 -04:00
|
|
|
no-cache-filters:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2022-07-18 11:24:11 -04:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2022-08-12 10:45:35 -04:00
|
|
|
with:
|
2022-08-16 20:17:37 -04:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-08-12 10:45:35 -04:00
|
|
|
driver-opts: |
|
2022-08-16 20:17:37 -04:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2022-07-18 11:24:11 -04: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 06:10:34 -05:00
|
|
|
attests-compat:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- buildx: latest
|
|
|
|
buildkit: moby/buildkit:buildx-stable-1
|
|
|
|
- buildx: latest
|
|
|
|
buildkit: moby/buildkit:v0.10.6
|
|
|
|
- buildx: v0.9.1
|
|
|
|
buildkit: moby/buildkit:buildx-stable-1
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2023-01-11 06:10:34 -05:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2023-01-11 06:10:34 -05:00
|
|
|
with:
|
|
|
|
version: ${{ matrix.buildx }}
|
|
|
|
driver-opts: |
|
|
|
|
network=host
|
|
|
|
image=${{ matrix.buildkit }}
|
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test/go
|
|
|
|
file: ./test/go/Dockerfile
|
|
|
|
outputs: type=cacheonly
|
|
|
|
|
2023-01-13 04:02:50 -05:00
|
|
|
provenance:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
attrs:
|
|
|
|
- ''
|
|
|
|
- mode=max
|
|
|
|
- builder-id=foo
|
|
|
|
- false
|
|
|
|
- true
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2023-01-13 04:02:50 -05:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2023-01-13 04:02:50 -05:00
|
|
|
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: binary
|
|
|
|
outputs: type=oci,dest=/tmp/build.tar
|
|
|
|
provenance: ${{ matrix.attrs }}
|
|
|
|
cache-from: type=gha,scope=provenance
|
|
|
|
cache-to: type=gha,scope=provenance,mode=max
|
|
|
|
|
2023-01-11 06:10:34 -05:00
|
|
|
sbom:
|
2023-01-11 06:12:09 -05:00
|
|
|
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
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2023-01-11 06:12:09 -05:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2023-01-11 06:12:09 -05:00
|
|
|
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 00:17:29 -05:00
|
|
|
sbom: true
|
2023-01-11 06:12:09 -05: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 08:03:02 -05:00
|
|
|
docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}'
|
2023-01-11 06:12:09 -05:00
|
|
|
-
|
|
|
|
name: Check output folder
|
|
|
|
if: matrix.target == 'binary'
|
|
|
|
run: |
|
|
|
|
tree /tmp/buildx-build
|
2023-01-30 13:21:25 -05:00
|
|
|
-
|
|
|
|
name: Print provenance
|
|
|
|
if: matrix.target == 'binary'
|
|
|
|
run: |
|
|
|
|
cat /tmp/buildx-build/provenance.json | jq
|
2023-01-11 06:12:09 -05:00
|
|
|
-
|
|
|
|
name: Print SBOM
|
|
|
|
if: matrix.target == 'binary'
|
|
|
|
run: |
|
|
|
|
cat /tmp/buildx-build/sbom.spdx.json | jq
|
|
|
|
|
2020-09-02 04:07:11 -04:00
|
|
|
multi:
|
2020-08-29 10:10:05 -04:00
|
|
|
runs-on: ubuntu-latest
|
2020-09-02 04:07:11 -04:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
dockerfile:
|
|
|
|
- multi
|
|
|
|
- multi-sudo
|
2020-09-04 23:18:15 -04:00
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
2020-08-29 10:10:05 -04:00
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2020-08-29 10:10:05 -04:00
|
|
|
-
|
|
|
|
name: Set up QEMU
|
2023-09-12 07:17:07 -04:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2020-08-29 10:10:05 -04:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
|
|
|
id: buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2020-08-29 10:10:05 -04:00
|
|
|
with:
|
2022-08-16 20:17:37 -04:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-08-12 10:45:35 -04:00
|
|
|
driver-opts: |
|
|
|
|
network=host
|
2022-08-16 20:17:37 -04:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2020-08-29 10:10:05 -04:00
|
|
|
-
|
|
|
|
name: Build and push
|
|
|
|
id: docker_build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
2021-03-28 10:43:51 -04:00
|
|
|
file: ./test/${{ matrix.dockerfile }}.Dockerfile
|
2020-08-29 10:10:05 -04: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 08:03:02 -05:00
|
|
|
docker buildx imagetools inspect localhost:5000/name/app:1.0.0 --format '{{json .}}'
|
2020-10-21 03:51:06 -04: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 14:30:50 -04: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
|
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2020-08-29 10:10:05 -04:00
|
|
|
-
|
2022-03-14 14:30:50 -04:00
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2022-03-14 14:30:50 -04:00
|
|
|
with:
|
2022-08-16 20:17:37 -04:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-03-14 14:30:50 -04: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
|
|
|
|
run: |
|
2023-08-11 05:52:26 -04:00
|
|
|
if [[ "${{ matrix.driver }}" = "docker-container" ]] && [[ "${{ matrix.load }}" = "false" ]] && [[ "${{ matrix.push }}" = "false" ]]; then
|
|
|
|
if [ -n "${{ steps.docker_build.outputs.digest }}" ]; then
|
|
|
|
echo "::error::Digest should be empty"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
elif [[ "${{ matrix.push }}" = "true" ]] && [[ -z "${{ steps.docker_build.outputs.digest }}" ]]; then
|
2022-03-14 14:30:50 -04:00
|
|
|
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: |
|
2023-08-11 05:52:26 -04:00
|
|
|
if [[ "${{ matrix.driver }}" = "docker-container" ]] && [[ "${{ matrix.load }}" = "false" ]] && [[ "${{ matrix.push }}" = "false" ]]; then
|
|
|
|
if [ -n "${{ steps.docker_build.outputs.imageid }}" ]; then
|
|
|
|
echo "::error::Image ID should be empty"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
elif [ -z "${{ steps.docker_build.outputs.imageid }}" ]; then
|
2022-03-14 14:30:50 -04:00
|
|
|
echo "::error::Image ID should not be empty"
|
|
|
|
exit 1
|
|
|
|
fi
|
2020-08-29 10:10:05 -04:00
|
|
|
-
|
2022-03-14 14:30:50 -04:00
|
|
|
name: Inspect image
|
|
|
|
if: ${{ matrix.load }}
|
|
|
|
run: |
|
|
|
|
set -x
|
|
|
|
docker image inspect ${{ steps.docker_build.outputs.imageid }}
|
2020-08-29 10:10:05 -04:00
|
|
|
|
2020-10-03 18:01:14 -04:00
|
|
|
registry-cache:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2020-10-03 18:01:14 -04:00
|
|
|
-
|
|
|
|
name: Set up QEMU
|
2023-09-12 07:17:07 -04:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2020-10-03 18:01:14 -04:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2020-10-03 18:01:14 -04:00
|
|
|
with:
|
2022-08-16 20:17:37 -04:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2020-10-11 13:17:08 -04:00
|
|
|
driver-opts: |
|
|
|
|
network=host
|
2022-08-16 20:17:37 -04:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2020-10-03 18:01:14 -04:00
|
|
|
-
|
2023-01-11 08:32:33 -05:00
|
|
|
name: Build and push
|
2020-10-03 18:01:14 -04:00
|
|
|
id: docker_build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
2021-03-28 10:43:51 -04:00
|
|
|
file: ./test/multi.Dockerfile
|
2020-10-03 18:01:14 -04: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-03 19:10:42 -04:00
|
|
|
cache-from: type=registry,ref=localhost:5000/name/app
|
|
|
|
cache-to: type=inline
|
2020-10-03 18:01:14 -04:00
|
|
|
-
|
2023-01-11 08:32:33 -05:00
|
|
|
name: Inspect
|
2020-10-03 18:01:14 -04:00
|
|
|
run: |
|
2023-01-11 08:03:02 -05:00
|
|
|
docker buildx imagetools inspect localhost:5000/name/app:latest --format '{{json .}}'
|
2020-10-21 03:51:06 -04:00
|
|
|
-
|
2023-01-11 08:32:33 -05:00
|
|
|
name: Check digest
|
2020-10-21 03:51:06 -04:00
|
|
|
run: |
|
|
|
|
if [ -z "${{ steps.docker_build.outputs.digest }}" ]; then
|
|
|
|
echo "::error::Digest should not be empty"
|
|
|
|
exit 1
|
|
|
|
fi
|
2020-10-03 18:01:14 -04:00
|
|
|
|
2021-07-29 10:57:22 -04:00
|
|
|
github-cache:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2021-07-29 10:57:22 -04:00
|
|
|
-
|
|
|
|
name: Set up QEMU
|
2023-09-12 07:17:07 -04:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2021-07-29 10:57:22 -04:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2021-07-29 10:57:22 -04:00
|
|
|
with:
|
2022-08-16 20:17:37 -04:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2021-07-29 10:57:22 -04:00
|
|
|
driver-opts: |
|
|
|
|
network=host
|
2022-08-16 20:17:37 -04:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2021-07-29 10:57:22 -04: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 08:03:02 -05:00
|
|
|
docker buildx imagetools inspect localhost:5000/name/app:1.0.0 --format '{{json .}}'
|
2022-04-28 03:31:47 -04:00
|
|
|
|
|
|
|
standalone:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2022-04-28 03:31:47 -04:00
|
|
|
-
|
2023-09-05 03:26:58 -04:00
|
|
|
name: Uninstall docker cli
|
2022-04-28 03:31:47 -04:00
|
|
|
run: |
|
2023-09-05 03:26:58 -04:00
|
|
|
if dpkg -s "docker-ce" >/dev/null 2>&1; then
|
|
|
|
sudo dpkg -r --force-depends docker-ce-cli docker-buildx-plugin
|
|
|
|
else
|
|
|
|
sudo apt-get purge -y moby-cli moby-buildx
|
|
|
|
fi
|
2022-04-28 03:31:47 -04:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2022-08-12 10:45:35 -04:00
|
|
|
with:
|
2022-08-16 20:17:37 -04:00
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
2022-08-12 10:45:35 -04:00
|
|
|
driver-opts: |
|
|
|
|
network=host
|
2022-08-16 20:17:37 -04:00
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
2022-04-28 03:31:47 -04:00
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/Dockerfile
|
2023-02-23 08:02:47 -05:00
|
|
|
|
|
|
|
named-context-pin:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2023-02-23 08:02:47 -05:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2023-02-23 08:02:47 -05:00
|
|
|
with:
|
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
|
|
|
driver-opts: |
|
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
|
|
|
-
|
|
|
|
name: Build base image
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/named-context.Dockerfile
|
|
|
|
build-contexts: |
|
|
|
|
alpine=docker-image://alpine:edge
|
|
|
|
|
|
|
|
named-context-docker:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2023-02-23 08:02:47 -05:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2023-02-23 08:02:47 -05:00
|
|
|
with:
|
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
|
|
|
driver: docker
|
|
|
|
-
|
|
|
|
name: Build base image
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/named-context-base.Dockerfile
|
|
|
|
load: true
|
|
|
|
tags: my-base-image:local
|
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/named-context.Dockerfile
|
|
|
|
build-contexts: |
|
|
|
|
base=docker-image://my-base-image:local
|
|
|
|
|
|
|
|
named-context-container:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2023-02-23 08:02:47 -05:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2023-02-23 08:02:47 -05:00
|
|
|
with:
|
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
|
|
|
driver-opts: |
|
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
|
|
|
network=host
|
|
|
|
-
|
|
|
|
name: Build base image
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/named-context-base.Dockerfile
|
|
|
|
tags: localhost:5000/my-base-image:latest
|
|
|
|
push: true
|
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/named-context.Dockerfile
|
|
|
|
build-contexts: |
|
|
|
|
alpine=docker-image://localhost:5000/my-base-image:latest
|
2023-06-05 05:35:09 -04:00
|
|
|
|
2023-09-08 09:28:08 -04:00
|
|
|
docker-config-malformed:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
-
|
|
|
|
name: Set malformed docker config
|
|
|
|
run: |
|
|
|
|
mkdir -p ~/.docker
|
|
|
|
echo 'foo_bar' >> ~/.docker/config.json
|
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
|
2023-06-05 05:35:09 -04:00
|
|
|
proxy-docker-config:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
squid-proxy:
|
|
|
|
image: ubuntu/squid:latest
|
|
|
|
ports:
|
|
|
|
- 3128:3128
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Check proxy
|
|
|
|
run: |
|
|
|
|
netstat -aptn
|
|
|
|
curl --retry 5 --retry-all-errors --retry-delay 0 --connect-timeout 5 --proxy http://127.0.0.1:3128 -v --insecure --head https://www.google.com
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2023-06-05 05:35:09 -04:00
|
|
|
-
|
|
|
|
name: Set proxy config
|
|
|
|
run: |
|
|
|
|
mkdir -p ~/.docker
|
|
|
|
echo '{"proxies":{"default":{"httpProxy":"http://127.0.0.1:3128","httpsProxy":"http://127.0.0.1:3128"}}}' > ~/.docker/config.json
|
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2023-06-05 05:35:09 -04:00
|
|
|
with:
|
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
|
|
|
driver-opts: |
|
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
|
|
|
network=host
|
|
|
|
buildkitd-flags: --debug
|
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/proxy.Dockerfile
|
|
|
|
|
|
|
|
proxy-buildkitd:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
squid-proxy:
|
|
|
|
image: ubuntu/squid:latest
|
|
|
|
ports:
|
|
|
|
- 3128:3128
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Check proxy
|
|
|
|
run: |
|
|
|
|
netstat -aptn
|
|
|
|
curl --retry 5 --retry-all-errors --retry-delay 0 --connect-timeout 5 --proxy http://127.0.0.1:3128 -v --insecure --head https://www.google.com
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 03:31:24 -04:00
|
|
|
uses: actions/checkout@v4
|
2023-06-05 05:35:09 -04:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 07:17:11 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2023-06-05 05:35:09 -04:00
|
|
|
with:
|
|
|
|
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
|
|
|
|
driver-opts: |
|
|
|
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
|
|
|
network=host
|
|
|
|
env.http_proxy=http://127.0.0.1:3128
|
|
|
|
env.https_proxy=http://127.0.0.1:3128
|
|
|
|
buildkitd-flags: --debug
|
|
|
|
-
|
|
|
|
name: Build
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/Dockerfile
|