Skip to content

Commit

Permalink
Dockerfile: smoke test stage
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max committed Jun 1, 2022
1 parent cabfff8 commit de02776
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: test

on:
workflow_dispatch:
push:
branches:
- 'master'
- '[0-9]+.[0-9]{2}'
tags:
- 'v*'
pull_request:

jobs:
smoke:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
- linux/ppc64le
- linux/s390x
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Test
uses: docker/bake-action@v2
with:
targets: binary-smoketest
set: |
*.platform=${{ matrix.platform }}
*.cache-from=type=gha,scope=binary-smoketest-${{ env.PLATFORM_PAIR }}
*.cache-to=type=gha,scope=binary-smoketest-${{ env.PLATFORM_PAIR }}
env:
DOCKER_LINKMODE: static
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,28 @@ FROM base AS release-all
COPY --from=releaser-all / /out
RUN find /out/ -type f \( ! -iname "checksums.txt" \) -print0 | sort -z | xargs -r0 shasum -a 256 -b | sed 's# .*/# #' > /out/checksums.txt

# smoke tests
# usage:
# > docker builx bake binary-smoketest
FROM --platform=$TARGETPLATFORM $BASE_IMAGE AS smoketest-binary
WORKDIR /usr/local/bin
COPY --link --from=tini /out/ .
COPY --link --from=runc /out/ .
COPY --link --from=containerd /out/ .
COPY --link --from=rootlesskit /out/ .
COPY --link --from=build /out/ .
RUN <<EOT
set -ex
docker-init -s -- date
runc --version
containerd --version
containerd-shim-runc-v2 -v
rootlesskit --version
rootlesskit-docker-proxy --help
dockerd --version
docker-proxy --help
EOT

# usage:
# > docker buildx bake binary
# > DOCKER_LINKMODE=dynamic docker buildx bake binary
Expand Down
12 changes: 12 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,18 @@ target "binary-cross" {
inherits = ["binary", "_platforms"]
}

target "binary-smoketest" {
inherits = ["_common"]
target = "smoketest-binary"
output = ["type=cacheonly"]
platforms = [
"linux/amd64",
"linux/arm64",
"linux/ppc64le",
"linux/s390x"
]
}

#
# all targets build binaries and extra tools as well (containerd, runc, ...)
#
Expand Down

0 comments on commit de02776

Please sign in to comment.