Docker #30
This file contains hidden or 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 | |
| on: | |
| pull_request: | |
| paths: | |
| - 'docker/**' | |
| - '.github/workflows/docker.yml' | |
| schedule: | |
| - cron: '0 0 * * *' | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| docker_builds: | |
| if: ${{ ! ((github.repository_owner != 'OSGeo') && (github.event_name == 'schedule')) }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: ["arm64", "amd64"] | |
| base: ["alpine-small", "alpine-normal", "ubuntu-small", "ubuntu-full"] | |
| name: ${{ matrix.base }}-${{ matrix.platform }} | |
| runs-on: ${{ matrix.platform == 'amd64' && 'ubuntu-latest' || 'ubuntu-24.04-arm' }} | |
| permissions: | |
| contents: read | |
| attestations: write | |
| packages: write | |
| id-token: write | |
| steps: | |
| - name: Set PUSH_PACKAGES due to schedule | |
| if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | |
| run: | | |
| echo "PUSH_PACKAGES=true" >> $GITHUB_ENV | |
| - name: Checkout | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| - name: Set up Docker | |
| uses: docker/setup-docker-action@e61617a16c407a86262fb923c35a616ddbe070b3 # v4.6.0 | |
| with: | |
| daemon-config: | | |
| { | |
| "debug": false, | |
| "features": { | |
| "containerd-snapshotter": true | |
| } | |
| } | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract container metadata | |
| id: meta | |
| uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0 | |
| with: | |
| images: | | |
| ghcr.io/osgeo/gdal | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| env: | |
| DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index | |
| - name: Build | |
| shell: bash -l {0} | |
| run: | | |
| set -e | |
| cd docker/${{ matrix.base }} | |
| if test "${{ env.PUSH_PACKAGES }}" == "true"; then | |
| ./build.sh --platform linux/${{ matrix.platform }} --with-multi-arch --push | |
| else | |
| ./build.sh --platform linux/${{ matrix.platform }} --with-multi-arch | |
| fi | |
| docker run --rm ghcr.io/osgeo/gdal:${{ matrix.base }}-latest-${{ matrix.platform }} gdalinfo --formats | |
| docker run --rm ghcr.io/osgeo/gdal:${{ matrix.base }}-latest-${{ matrix.platform }} ogrinfo --formats | |
| create-manifest: | |
| permissions: | |
| contents: read | |
| packages: write | |
| attestations: write | |
| id-token: write | |
| runs-on: ubuntu-latest | |
| needs: docker_builds | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| tag: ["ubuntu-full", "ubuntu-small", "alpine-small", "alpine-normal"] | |
| steps: | |
| - name: Set PUSH_PACKAGES due to schedule | |
| if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | |
| run: | | |
| echo "PUSH_PACKAGES=true" >> $GITHUB_ENV | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 | |
| if: env.PUSH_PACKAGES == 'true' | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create and push multi-platform manifest | |
| if: env.PUSH_PACKAGES == 'true' | |
| run: | | |
| docker buildx imagetools create \ | |
| -t ghcr.io/osgeo/gdal:${{ matrix.tag }}-latest \ | |
| ghcr.io/osgeo/gdal:${{ matrix.tag }}-latest-amd64 \ | |
| ghcr.io/osgeo/gdal:${{ matrix.tag }}-latest-arm64 | |
| - name: Alias ubuntu-full-latest to latest | |
| if: matrix.tag == 'ubuntu-full' && env.PUSH_PACKAGES == 'true' | |
| run: | | |
| docker buildx imagetools create ghcr.io/osgeo/gdal:ubuntu-full-latest --tag ghcr.io/osgeo/gdal:latest | |
| docker_proprietary_sdk: | |
| if: ${{ ! ((github.repository_owner != 'OSGeo') && (github.event_name == 'schedule')) }} | |
| runs-on: ubuntu-latest | |
| name: proprietary-sdks | |
| env: | |
| PUSH_PACKAGES: false | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| - name: Set up Docker | |
| uses: docker/setup-docker-action@e61617a16c407a86262fb923c35a616ddbe070b3 # v4.6.0 | |
| with: | |
| daemon-config: | | |
| { | |
| "debug": false, | |
| "features": { | |
| "containerd-snapshotter": true | |
| } | |
| } | |
| - name: build | |
| shell: bash -l {0} | |
| run: | | |
| set -e | |
| cd docker/ubuntu-full | |
| ./build.sh --platform linux/amd64 --with-multi-arch --with-oracle --with-mrsid --with-ecw | |
| docker run --rm ghcr.io/osgeo/gdal:ubuntu-full-latest-amd64 gdalinfo --formats | |
| docker run --rm ghcr.io/osgeo/gdal:ubuntu-full-latest-amd64 ogrinfo --formats |