Fix: Cannot locally test azul-docker-elasticsearch changes (DataBiosphere/azul#5986) #42
Workflow file for this run
This file contains 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: | |
push: | |
branches: | |
- "main" | |
env: | |
# The fully qualified image name of the image to build. The first component is | |
# the host name of the registry that primarily hosts the image. | |
# | |
azul_docker_elasticsearch_image: docker.io/ucscgi/azul-elasticsearch | |
# An optional prefix for the image name if the image is to be pushed to an | |
# alternate registry instead of the one noted in the image name above. | |
# | |
azul_docker_registry: "" | |
# The tag of the Elasticsearch image that's used as the base for this image. | |
# | |
azul_docker_elasticsearch_upstream_version: 7.17.18 | |
# The version of this image. The image will be tagged with the version of the | |
# upstream image followed by the value of this variable. Increment this value | |
# to update the OS packages installed in the image. | |
# | |
azul_docker_elasticsearch_internal_version: 13 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
# To facilitate local builds using the Makefile | |
driver-opts: ${{ startsWith(env.azul_docker_registry, 'localhost:') && 'network=host' || '' }} | |
- name: Log into registry | |
if: > | |
github.event_name != 'pull_request' | |
&& vars.AZUL_DOCKER_REGISTRY_USER | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.AZUL_DOCKER_REGISTRY_USER }} | |
password: ${{ secrets.AZUL_DOCKER_REGISTRY_PASSWORD }} | |
- name: Build and conditionally push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
build-args: | | |
azul_docker_elasticsearch_upstream_version=${{ env.azul_docker_elasticsearch_upstream_version }} | |
azul_docker_elasticsearch_internal_version=${{ env.azul_docker_elasticsearch_internal_version }} | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: "${{ format( | |
'{0}{1}:{2}-{3}', | |
env.azul_docker_registry, | |
env.azul_docker_elasticsearch_image, | |
env.azul_docker_elasticsearch_upstream_version, | |
env.azul_docker_elasticsearch_internal_version | |
) }}" | |
cache-from: "${{ format( | |
'type=registry,ref={0}{1}_buildcache', | |
env.azul_docker_registry, | |
env.azul_docker_elasticsearch_image | |
) }}" | |
cache-to: "${{ github.event_name == 'pull_request' && '' || format( | |
'type=registry,ref={0}{1}_buildcache,mode=max', | |
env.azul_docker_registry, | |
env.azul_docker_elasticsearch_image | |
) }}" |