Add 17, deprecate 12 #46
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
name: Docker Hub | |
on: | |
push: | |
branches: | |
- "main" | |
- "dev" | |
- "dev/*" | |
schedule: | |
# build a new set of images weekly at 00:30hrs UTC so that we quickly | |
# get updates from upstream images. | |
- cron: "30 0 * * 6" | |
env: | |
IMAGE: infrastructureascode/postgres | |
BASE_IMAGE: postgres | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
matrix: | |
include: | |
- distro: alpine | |
version: "13-alpine" | |
- distro: alpine | |
version: "14-alpine" | |
- distro: alpine | |
version: "15-alpine" | |
- distro: alpine | |
version: "16-alpine" | |
- distro: alpine | |
version: "17-alpine" | |
- distro: debian | |
version: "13" | |
- distro: debian | |
version: "14" | |
- distro: debian | |
version: "15" | |
- distro: debian | |
version: "16" | |
- distro: debian | |
version: "17" | |
- distro: debian | |
version: latest | |
steps: | |
- uses: actions/checkout@v3 | |
# build locally first before the multiarch build with buildx | |
- name: Build image | |
run: docker build --rm -f ${{ matrix.distro }}.Dockerfile | |
--build-arg base_image=${{ env.BASE_IMAGE }}:${{ matrix.version }} | |
--tag ${{ env.IMAGE }}:${{ matrix.version }} | |
. | |
- name: Install Docker Compose | |
uses: withlogicco/setup-compose-cli@v1 | |
- name: Test alpine image | |
env: | |
IMAGE: ${{ env.IMAGE }}:${{ matrix.version }} | |
run: docker compose -f docker-compose.test.yml run sut | |
# if we get here, the test passed, so let's buildx and push | |
- name: Log in to the container registry | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up QEMU | |
id: qemu | |
uses: docker/setup-qemu-action@v2 | |
with: | |
image: tonistiigi/binfmt:latest | |
platforms: all | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
version: latest | |
- name: Available platforms | |
run: echo ${{ steps.buildx.outputs.platforms }} | |
- name: Build image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ${{ matrix.distro }}.Dockerfile | |
build-args: base_image=${{ env.BASE_IMAGE }}:${{ matrix.version }} | |
platforms: linux/amd64,linux/arm64/v8,linux/arm/v6 | |
push: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | |
tags: ${{ env.IMAGE }}:${{ matrix.version }} | |
- name: Inspect image | |
run: docker buildx imagetools inspect ${{ env.IMAGE }}:${{ matrix.version }} | |
if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} |