Skip to content

Docker Build

Docker Build #1300

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
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_RELEASE=noble make docker-build
UBUNTU_RELEASE=jammy 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 images
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:jammy" "$IMAGE_ID:$DB_VERSION-jammy"
docker tag "$IMAGE_ID:noble" "$IMAGE_ID:$DB_VERSION-noble"
docker tag "$IMAGE_ID:noble" "$IMAGE_ID:$DB_VERSION"
docker tag "$IMAGE_ID:noble" "$IMAGE_ID:latest"
docker push "$IMAGE_ID:latest"
docker push "$IMAGE_ID:jammy"
docker push "$IMAGE_ID:noble"
docker push "$IMAGE_ID:$DB_VERSION"
docker push "$IMAGE_ID:$DB_VERSION-jammy"
docker push "$IMAGE_ID:$DB_VERSION-noble"