Skip to content

Switch to GHA and GHCR for image building and hosting #46

Switch to GHA and GHCR for image building and hosting

Switch to GHA and GHCR for image building and hosting #46

Workflow file for this run

name: Build and Push Georust Docker Images
on:
push:
branches:
- main
- staging
- trying
pull_request:
merge_group:
env:
BASE_IMAGE_NAME: libproj-builder
jobs:
build_base_image:
name: Build the base image for geo and proj
runs-on: ubuntu-latest
strategy:
matrix:
rust_version: [1.77]
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: Set Up Builder
run: |
docker buildx create --name mybuilder
docker buildx use mybuilder
docker buildx inspect --bootstrap
- name: Build and push base Dockerfile
id: basebuild
uses: docker/build-push-action@v5
with:
file: ./dockerfiles/libproj-builder
push: true
tags: ${{ github.repository_owner }}/${{ BASE_IMAGE_NAME }}:proj-${{ matrix.proj_version }}-rust-${{ matrix.rust_version }}

Check failure on line 54 in .github/workflows/imagebuild.yml

View workflow run for this annotation

GitHub Actions / Build and Push Georust Docker Images

Invalid workflow file

The workflow is not valid. .github/workflows/imagebuild.yml (Line: 54, Col: 15): Unrecognized named-value: 'BASE_IMAGE_NAME'. Located at position 1 within expression: BASE_IMAGE_NAME .github/workflows/imagebuild.yml (Line: 55, Col: 18): Unrecognized named-value: 'BASE_IMAGE_NAME'. Located at position 1 within expression: BASE_IMAGE_NAME
outputs: type=docker,dest=/tmp/${{ BASE_IMAGE_NAME }}-proj-${{ matrix.proj_version }}-rust-${{ matrix.rust_version }}.tar
build-args: |
RUST_VERSION=${{ matrix.rust_version }}
PROJ_VERSION=${{ matrix.proj_version }}
- name: Test base image
if: steps.basebuild.outcome == 'success'
run: |
# docker run -v ${{ github.workspace }}:/tmp/georust -e CARGO_TARGET_DIR=/tmp/cargo-target -w /tmp/georust/geo georust/${{ BASE_IMAGE_NAME }}:${{ github.repository_owner }}/$BASE_IMAGE_NAME:proj-${{ matrix.proj_version }}-rust-${{ matrix.rust_version }} /bin/bash -c "cargo test"
- name: Upload Image to artifact cache
if: steps.basebuild.outcome == 'success'
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ${{ BASE_IMAGE_NAME }}-proj-${{ matrix.proj_version }}-rust-${{ matrix.rust_version }}
path: /tmp/${{ BASE_IMAGE_NAME }}-proj-${{ matrix.proj_version }}-rust-${{ matrix.rust_version }}.tar
build_dependent_images:
name: Build dependent images for geo and proj
needs: build_base_image
runs-on: ubuntu-latest
strategy:
matrix:
docker_image_name:
- proj-ci
- proj-ci-without-system-proj
- geo-ci
rust_version: [1.77]
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: Set Up Builder
run: |
docker buildx create --name mybuilder
docker buildx use mybuilder
docker buildx inspect --bootstrap
- name: Build and push base Dockerfile
id: basebuild
uses: docker/build-push-action@v5
with:
file: ./dockerfiles/libproj-builder
push: true
tags: ${{ github.repository_owner }}/${{ matrix.docker_image_name }}:proj-${{ matrix.proj_version }}-rust-${{ matrix.rust_version }}
outputs: type=docker,dest=/tmp/${{ matrix.docker_image_name }}-proj-${{ matrix.proj_version }}-rust-${{ matrix.rust_version }}.tar
build-args: |
RUST_VERSION=${{ matrix.rust_version }}
PROJ_VERSION=${{ matrix.proj_version }}
- name: Test image
if: steps.basebuild.outcome == 'success'
run: |
# docker run -v ${{ github.workspace }}:/tmp/georust -e CARGO_TARGET_DIR=/tmp/cargo-target -w /tmp/georust/geo georust/geo-ci:${{ github.repository_owner }}/${{ matrix.docker_image_name }}:proj-${{ matrix.proj_version }}-rust-${{ matrix.rust_version }} /bin/bash -c "cargo test"
- name: Upload Image to artifact cache
if: steps.basebuild.outcome == 'success'
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ${{ matrix.docker_image_name }}-proj-${{ matrix.proj_version }}-rust-${{ matrix.rust_version }}
path: /tmp/${{ matrix.docker_image_name }}-proj-${{ matrix.proj_version }}-rust-${{ matrix.rust_version }}.tar
- name: Build geo and proj Dockerfiles
if: steps.basebuild.outcome == 'success'
uses: docker/build-push-action@v5
with:
file: ./dockerfiles/${{ matrix.docker_image_name }}
push: false
tags: ${{ github.repository_owner }}/${{ matrix.docker_image_name }}:proj-${{ matrix.proj_version }}-rust-${{ matrix.rust_version }}
outputs: type=docker,dest=/tmp/${{ matrix.docker_image_name }}-proj-${{ matrix.proj_version }}-rust-${{ matrix.rust_version }}.tar
build-args: |
RUST_VERSION=${{ matrix.rust_version }}
PROJ_VERSION=${{ matrix.proj_version }}
- name: Test image
run: |
# docker run -v ${{ github.workspace }}:/tmp/georust -e CARGO_TARGET_DIR=/tmp/cargo-target -w /tmp/georust/geo georust/geo-ci:${{ github.repository_owner }}/${{ matrix.docker_image_name }}:proj-${{ matrix.proj_version }}-rust-${{ matrix.rust_version }} /bin/bash -c "cargo test"
- name: Upload Image to artifact cache
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ${{ matrix.docker_image_name }}-proj-${{ matrix.proj_version }}-rust-${{ matrix.rust_version }}
path: /tmp/${{ matrix.docker_image_name }}-proj-${{ matrix.proj_version }}-rust-${{ matrix.rust_version }}.tar