Skip to content

Build Docker images for Ubuntu 22.04 and 24.04 #1280

Build Docker images for Ubuntu 22.04 and 24.04

Build Docker images for Ubuntu 22.04 and 24.04 #1280

Workflow file for this run

---
name: Docker Build
permissions: read-all
on:
pull_request:
branches:
- main
schedule:
- cron: '0 23 * * *'
jobs:
docker-build:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
timeout-minutes: 90 # will this need updating?
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get date for DB version
run: |
DB_VERSION="nightly-$(date '+%y%m%d')"
export DB_VERSION
echo "DB_VERSION=$DB_VERSION" >> "$GITHUB_ENV"
- name: Build Docker Images
run: |
export NO_CACHE="${{ github.ref == 'refs/heads/main' }}"
UBUNTU_VERSION=22.04 DB="$DB_VERSION" make docker-build
UBUNTU_VERSION=24.04 DB="$DB_VERSION" make docker-build
- name: Log in to registry
if: github.ref == 'refs/heads/main'
# This is where you will update the PAT to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image
if: github.ref == 'refs/heads/main'
run: |
IMAGE_ID="ghcr.io/${{ github.repository_owner }}/idris2-pack"
# Change all uppercase to lowercase
IMAGE_ID="$(echo "$IMAGE_ID" | tr '[:upper:]' '[:lower:]')"
# Strip git ref prefix from version
echo IMAGE_ID="$IMAGE_ID"
echo DB_VERSION="$DB_VERSION"
docker tag "$IMAGE_ID-22.04:latest" "$IMAGE_ID-22.04:$DB_VERSION"
docker tag "$IMAGE_ID-24.04:latest" "$IMAGE_ID-24.04:$DB_VERSION"
docker tag "$IMAGE_ID-24.04:latest" "$IMAGE_ID:$DB_VERSION"
docker tag "$IMAGE_ID-24.04:latest" "$IMAGE_ID:latest"
docker push "$IMAGE_ID:latest"
docker push "$IMAGE_ID-22.04:latest"
docker push "$IMAGE_ID-24.04:latest"
docker push "$IMAGE_ID:$DB_VERSION"
docker push "$IMAGE_ID-22.04:$DB_VERSION"
docker push "$IMAGE_ID-24.04:$DB_VERSION"