Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 41 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
8d39a3d
Switch to GHA
urschrei Apr 2, 2024
cfcf684
Match makefile to renamed Dockerfiles for now
urschrei Apr 3, 2024
b5b041a
Try to push base image before building contingent images
urschrei Apr 3, 2024
de5d51d
Typo fix
urschrei Apr 3, 2024
f71188f
Jobs are now dependent
urschrei Apr 3, 2024
fa3251e
???
urschrei Apr 3, 2024
6eb401d
Fix base image name
urschrei Apr 3, 2024
7e144ca
Try to fix env base image name
urschrei Apr 3, 2024
189a678
More env fix
urschrei Apr 3, 2024
f768980
Try setting GHCR tag explicitly
urschrei Apr 3, 2024
55374a8
Modify dependent image tag names with ghcr
urschrei Apr 3, 2024
e8f9984
Simplify
urschrei Apr 3, 2024
0a44736
Tag dependent images with ghcr so they're uploaded there
urschrei Apr 3, 2024
93d23a2
Remove Makefile setup
urschrei Apr 3, 2024
bd390b0
Update Dockerfile URL comments
urschrei Apr 3, 2024
0813b2a
Add linux/arm64 platform
urschrei Apr 3, 2024
199712e
Define separate test and push steps
urschrei Apr 3, 2024
5e8d668
No multi-platform for now
urschrei Apr 3, 2024
4632b31
Don't mention multi-platform in output
urschrei Apr 3, 2024
661c8de
Try to fix multi-platform push
urschrei Apr 3, 2024
542dc1a
Fix platforms typo
urschrei Apr 3, 2024
29eb3c9
Disable multi-platform again
urschrei Apr 3, 2024
daf0e41
Ensure git is available in our containers
urschrei Apr 3, 2024
4525b7f
Try to detect container and run a test for geo
urschrei Apr 3, 2024
133c2da
Fix test command setup
urschrei Apr 3, 2024
df5bf1c
Ensure cmake is available in geo-ci
urschrei Apr 3, 2024
04c1459
More specific tests
urschrei Apr 3, 2024
d6b5f8e
Try not using slim
urschrei Apr 3, 2024
63efd15
Fix test typos
urschrei Apr 3, 2024
36da62e
Ensure sqlite3 is present
urschrei Apr 3, 2024
c8bd434
README update
urschrei Apr 3, 2024
e60a8ca
README typo fix
urschrei Apr 3, 2024
5719f4b
Use same sqlite lib in all images
urschrei Apr 3, 2024
df0ff8e
Use map of image name / test commands for sub-images
urschrei Apr 4, 2024
75a9d69
Try to remove QEMU
urschrei Apr 4, 2024
b47710c
Remove SQlite3 deps
urschrei Apr 4, 2024
1378cff
Add proj-sys tests
urschrei Apr 4, 2024
cfe241c
Test proj-sys
urschrei Apr 4, 2024
cda435b
Fix typo
urschrei Apr 4, 2024
830de1c
Build rustc MSRV + two most recent versions
urschrei Apr 4, 2024
f97d761
Don't trim trailing 0 in Rust 1.70
urschrei Apr 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 140 additions & 0 deletions .github/workflows/imagebuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
name: Build and Push Georust Docker Images

on:
push:
branches:
- main
- staging
- trying
pull_request:
merge_group:

env:
LIBPROJ_VERSION: 9.4.0
BASE_IMAGE_NAME: libproj-builder
urschrei marked this conversation as resolved.
Show resolved Hide resolved

jobs:
build_base_image:
name: Build the base image for geo and proj
runs-on: ubuntu-latest

strategy:
matrix:
rust_version: [1.77]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we actually need to specify rust_version for the libprojbuilder - it's not even using rust, right? It's fine to leave it this way for now, since that's how it's always been, but worth considering for future simplification. It'd speed up the build a bit and avoid having to track supported versions in two places.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooh. That's a good point.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The libproj-builder Docker image does expect a Rust version:

ARG RUST_VERSION

Unless I'm misunderstanding something about how the multi-stage builds work?


steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up QEMU
urschrei marked this conversation as resolved.
Show resolved Hide resolved
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
urschrei marked this conversation as resolved.
Show resolved Hide resolved

- 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 export base image to Docker
uses: docker/build-push-action@v5
with:
file: ./dockerfiles/${{ env.BASE_IMAGE_NAME }}
push: false
load: true
platforms: linux/amd64
tags: ghcr.io/${{ github.repository_owner }}/${{ env.BASE_IMAGE_NAME }}:proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}
urschrei marked this conversation as resolved.
Show resolved Hide resolved
build-args: |
RUST_VERSION=${{ matrix.rust_version }}
PROJ_VERSION=${{ env.LIBPROJ_VERSION }}

- name: Test base image
run: |
# docker run --rm ghcr.io/${{ github.repository_owner }}/${{ env.BASE_IMAGE_NAME }}:proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}
urschrei marked this conversation as resolved.
Show resolved Hide resolved

- name: Push tested base image
uses: docker/build-push-action@v5
with:
file: ./dockerfiles/${{ env.BASE_IMAGE_NAME }}
push: true
load: false
# platforms: linux/amd64,linux/arm64
tags: ghcr.io/${{ github.repository_owner }}/${{ env.BASE_IMAGE_NAME }}:proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}
outputs: type=docker,dest=/tmp/${{ env.BASE_IMAGE_NAME }}-proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}.tar
build-args: |
RUST_VERSION=${{ matrix.rust_version }}
PROJ_VERSION=${{ env.LIBPROJ_VERSION }}

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]
urschrei marked this conversation as resolved.
Show resolved Hide resolved

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 ${{ matrix.docker_image_name }}
uses: docker/build-push-action@v5
with:
file: ./dockerfiles/${{ matrix.docker_image_name }}
push: false
load: true
platforms: linux/amd64
tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.docker_image_name }}:proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}
build-args: |
RUST_VERSION=${{ matrix.rust_version }}
PROJ_VERSION=${{ env.LIBPROJ_VERSION }}

- name: Test ${{ matrix.docker_image_name }}
run: |
# docker run --rm ghcr.io/${{ github.repository_owner }}/${{ matrix.docker_image_name }}:proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}

- name: Push tested ${{ matrix.docker_image_name }} image
uses: docker/build-push-action@v5
with:
file: ./dockerfiles/${{ matrix.docker_image_name }}
push: true
load: false
# platforms: linux/amd64,linux/arm64
tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.docker_image_name }}:proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}
outputs: type=docker,dest=/tmp/${{ matrix.docker_image_name }}-proj-${{ env.LIBPROJ_VERSION }}-rust-${{ matrix.rust_version }}.tar
build-args: |
RUST_VERSION=${{ matrix.rust_version }}
PROJ_VERSION=${{ env.LIBPROJ_VERSION }}
80 changes: 0 additions & 80 deletions Makefile

This file was deleted.

6 changes: 3 additions & 3 deletions dockerfiles/geo-ci.Dockerfile → dockerfiles/geo-ci
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# https://hub.docker.com/orgs/georust/geo-ci
# https://github.com/orgs/georust/packages/container/package/geo-ci

# ------------------------------------------------------------------------------
# Final stage
Expand All @@ -7,8 +7,8 @@
ARG RUST_VERSION
ARG PROJ_VERSION

FROM georust/libproj-builder:proj-${PROJ_VERSION}-rust-${RUST_VERSION} as libproj-builder
FROM rust:$RUST_VERSION-bullseye
FROM ghcr.io/georust/libproj-builder:proj-${PROJ_VERSION}-rust-${RUST_VERSION} as libproj-builder
FROM rust:$RUST_VERSION-slim-bullseye

ARG RUST_VERSION
ARG PROJ_VERSION
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# https://hub.docker.com/orgs/georust/libproj-builder
# https://github.com/orgs/georust/packages/container/package/libproj-builder

# Builds libproj from source

ARG RUST_VERSION
FROM rust:$RUST_VERSION-bullseye
FROM rust:$RUST_VERSION-slim-bullseye

ARG RUST_VERSION
ARG PROJ_VERSION
Expand Down
4 changes: 2 additions & 2 deletions dockerfiles/proj-ci.Dockerfile → dockerfiles/proj-ci
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# https://hub.docker.com/orgs/georust/proj-ci
# https://github.com/orgs/georust/packages/container/package/proj-ci

ARG RUST_VERSION
ARG PROJ_VERSION
FROM georust/libproj-builder:proj-${PROJ_VERSION}-rust-${RUST_VERSION}
FROM ghcr.io/georust/libproj-builder:proj-${PROJ_VERSION}-rust-${RUST_VERSION}

ARG RUST_VERSION
ARG PROJ_VERSION
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# https://hub.docker.com/orgs/georust/proj-ci-without-system-proj
# https://github.com/orgs/georust/packages/container/package/proj-ci-without-system-proj

# This container is based on the libproj-builder container, which has built
# libproj, and thus has all the dependencies for building proj from source, but
Expand All @@ -7,7 +7,7 @@
ARG RUST_VERSION
ARG PROJ_VERSION

FROM georust/libproj-builder:proj-${PROJ_VERSION}-rust-${RUST_VERSION}
FROM ghcr.io/georust/libproj-builder:proj-${PROJ_VERSION}-rust-${RUST_VERSION}

ARG RUST_VERSION
ARG PROJ_VERSION
Expand Down
1 change: 0 additions & 1 deletion proj-version.txt

This file was deleted.

88 changes: 0 additions & 88 deletions run-rust.sh

This file was deleted.

11 changes: 0 additions & 11 deletions rust-versions.txt

This file was deleted.