Skip to content

Build and Push Docker Nightly #134

Build and Push Docker Nightly

Build and Push Docker Nightly #134

name: Build and Push Docker Nightly
on:
schedule:
# 03:40 UTC, to avoid high loads at the day and hour boundary
- cron: '40 3 * * *'
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
concurrency:
group: nightly-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
ref: 'main'
submodules: recursive
fetch-depth: 0
fetch-tags: true
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup
id: setup
run: |
{
echo "ENDB_GIT_DESCRIBE=$(git describe --always --dirty --tags)"
echo "RUST_OS=latest"
echo "SBCL_OS=debian"
echo "ENDB_OS=debian"
echo "DOCKER_TAG=endatabas/endb:nightly"
} >> "$GITHUB_OUTPUT"
- name: Print Setup
id: print_setup
run: |
{
echo "### Workflow variables"
echo "| Variable | Value |"
echo "| ----------------- | -------------------------------------------- |"
echo "| ENDB_GIT_DESCRIBE | ${{ steps.setup.outputs.ENDB_GIT_DESCRIBE }} |"
echo "| RUST_OS | ${{ steps.setup.outputs.RUST_OS }} |"
echo "| SBCL_OS | ${{ steps.setup.outputs.SBCL_OS }} |"
echo "| ENDB_OS | ${{ steps.setup.outputs.ENDB_OS }} |"
echo "| DOCKER_TAG | ${{ steps.setup.outputs.DOCKER_TAG }} |"
} >> $GITHUB_STEP_SUMMARY
- name: Build and Push Docker
uses: docker/build-push-action@v5
with:
pull: true # equivalent to --pull, not --pull-always / --pull=always
push: true
context: .
# https://docs.docker.com/build/ci/github-actions/multi-platform/
# https://dev.to/cloudx/multi-arch-docker-images-the-easy-way-with-github-actions-4k54
platforms: linux/amd64 # ,linux/arm64
file: ./Dockerfile
build-args: |
ENDB_GIT_DESCRIBE=${{ steps.setup.outputs.ENDB_GIT_DESCRIBE }}
RUST_OS=${{ steps.setup.outputs.RUST_OS }}
SBCL_OS=${{ steps.setup.outputs.SBCL_OS }}
ENDB_OS=${{ steps.setup.outputs.ENDB_OS }}
tags: ${{ steps.setup.outputs.DOCKER_TAG }} # this is circuitous, but consistent.
# not currently building all 3 tags, as we only push one.