Merge pull request #10 from CheyiLin/dependabot/github_actions/action… #81
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions | |
name: dev | |
on: | |
push: | |
branches: | |
- master | |
tags-ignore: | |
- "*" | |
paths-ignore: | |
- README.md | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- ctx: v1 | |
version: "1.29.35" | |
- ctx: v2 | |
version: "2.13.13" | |
env: | |
BUILD_PLATFORMS: linux/amd64,linux/arm64 | |
DOCKER_VERSION: "24.0.5" | |
services: | |
registry: | |
image: registry:2 | |
ports: | |
- 5000:5000 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Docker Metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
# https://github.com/docker/metadata-action | |
with: | |
images: | | |
localhost:5000/cheyilin/docker-awscli | |
tags: | | |
type=raw,value=${{ matrix.ctx }} | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: ${{ env.BUILD_PLATFORMS }} | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
driver-opts: network=host | |
- name: Build and Push | |
uses: docker/build-push-action@v4 | |
# https://github.com/docker/build-push-action | |
with: | |
context: ${{ matrix.ctx }} | |
platforms: ${{ env.BUILD_PLATFORMS }} | |
build-args: | | |
DOCKER_VERSION=${{ env.DOCKER_VERSION }} | |
AWS_CLI_VERSION=${{ matrix.version }} | |
push: true | |
cache-from: type=gha,scope=${{ matrix.ctx }} | |
cache-to: type=gha,scope=${{ matrix.ctx }},mode=max | |
labels: ${{ steps.meta.outputs.labels }} | |
tags: | | |
${{ steps.meta.outputs.tags }} | |
- name: Inspect Image | |
run: | | |
docker buildx imagetools inspect ${{ steps.meta.outputs.tags }} | |
- name: Test Preflight | |
run: | | |
docker network create dind | |
docker run -d --privileged \ | |
--network=dind --network-alias=docker -e DOCKER_TLS_CERTDIR= docker:${{ env.DOCKER_VERSION }}-dind \ | |
--tls=false --registry-mirror=https://mirror.gcr.io | |
docker run --network=dind praqma/network-multitool \ | |
sh -c 'until curl -sf http://docker:2375/_ping; do echo "* Wait for dockerd to be ready ..."; sleep 1; done' | |
- name: Test (linux/amd64) | |
run: | | |
CMD="docker run --platform=linux/amd64 --network=dind ${{ steps.meta.outputs.tags }}" | |
${CMD} docker version | |
${CMD} aws --version | |
- name: Test (linux/arm64) | |
run: | | |
CMD="docker run --platform=linux/arm64 --network=dind ${{ steps.meta.outputs.tags }}" | |
${CMD} docker version | |
${CMD} aws --version | |
- name: Comment | |
uses: peter-evans/commit-comment@v2 | |
with: | |
body: | | |
Pipeline has passed. :tada: | |
- context: `${{ matrix.ctx }}` | |
- version: `${{ matrix.version }}` |