Skip to content

FIXME (DataBiosphere/azul#6173) #55

FIXME (DataBiosphere/azul#6173)

FIXME (DataBiosphere/azul#6173) #55

name: Docker
on:
pull_request:
push:
branches:
- master
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_pycharm_image: docker.io/ucscgi/azul-pycharm
# 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 image that's used as the base for this image. Because this
# value isn't reflected in the tag for this image, you also need to bump the
# internal version below when changing this variable.
#
azul_docker_pycharm_base_image_tag: bullseye-20240408
# The version of PyCharm to install in this image.
#
# FIXME: Wait for the PyCharm 2024.1.1 image release to upgrade
# https://github.com/DataBiosphere/azul/issues/6173
azul_docker_pycharm_upstream_version: 2023.3.5
# 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_pycharm_internal_version: 20
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_pycharm_base_image_tag=${{ env.azul_docker_pycharm_base_image_tag }}
azul_docker_pycharm_upstream_version=${{ env.azul_docker_pycharm_upstream_version }}
azul_docker_pycharm_internal_version=${{ env.azul_docker_pycharm_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_pycharm_image,
env.azul_docker_pycharm_upstream_version,
env.azul_docker_pycharm_internal_version
) }}"
cache-from: "${{ format(
'type=registry,ref={0}{1}_buildcache',
env.azul_docker_registry,
env.azul_docker_pycharm_image
) }}"
# The value after '&&' in a ternary operator must be truthy, and since
# an empty string is falsy, we use ' ' instead.
cache-to: "${{ github.event_name == 'pull_request' && ' ' || format(
'type=registry,ref={0}{1}_buildcache,mode=max',
env.azul_docker_registry,
env.azul_docker_pycharm_image
) }}"