Switch to GHA and GHCR for image building and hosting #11
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: Build and Push Docker Images | |
on: | |
push: | |
branches: | |
- main | |
- staging | |
- trying | |
pull_request: | |
merge_group: | |
jobs: | |
build_and_push: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
docker_image_name: | |
- proj-ci | |
- proj-ci-without-system-proj | |
- libproj-builder | |
- geo-ci | |
rust_version: [1.69] | |
proj_version: [9.4.0] | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Docker images | |
run: | | |
docker buildx create --name mybuilder | |
docker buildx use mybuilder | |
docker buildx inspect --bootstrap | |
# Define the build step as a reusable command | |
- name: Build Dockerfile | |
uses: docker/build-push-action@v5 | |
with: | |
context: "{{defaultContext}}:dockerfiles" | |
file: ${{ matrix.docker_image_name }} | |
push: false | |
tags: ${{ github.repository_owner }}/${{ matrix.docker_image_name }}:proj-${{ matrix.proj_version }}-rust-${{ matrix.rust_version }} | |
build-args: | | |
RUST_VERSION=${{ matrix.rust_version }},PROJ_VERSION=${{ matrix.proj_version }} | |