PromucFlow_constructor/.github/workflows/docker-base-image.yml
Shrikant Sharat Kandula deb55d8b21
ci: Create separate base image so daily CI can cache better and run faster (#28182)
The layers in the Dockerfile that depend on downloading large files from
external sources, doesn't have to run every day, or at every PR. We
tried using Docker's caching configuration, but it's not as reliable as
we'd have liked.

A separate base image lends us much more control over the how long we
cache the downloaded files and how often we redo this.

This PR only _adds_ the base image. It doesn't change anything in the
build of the existing Docker image. That'll happen once we have the base
images for `release` and `master` already present on DockerHub.
2023-10-18 14:17:38 +05:30

50 lines
1.2 KiB
YAML

name: Docker Base Image
on:
workflow_dispatch:
jobs:
build-docker:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout the head commit of the branch
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Get tag
id: tag
run: |
tag="${GITHUB_REF_NAME//\//-}"
if [[ "$tag" == master ]]; then
tag=nightly
fi
echo "tag=$tag" >> "$GITHUB_OUTPUT"
- name: Build and push base image
uses: docker/build-push-action@v5
with:
context: .
file: deploy/docker/base.dockerfile
push: true
platforms: linux/arm64,linux/amd64
tags: |
${{ vars.DOCKER_HUB_ORGANIZATION }}/base-${{ vars.EDITION }}:${{ steps.tag.outputs.tag }}