Remove support for docker bakefile #2448
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: Build Docker Images | |
permissions: | |
contents: read | |
security-events: write | |
on: | |
push: | |
branches: | |
- main | |
- release/* | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
commit: | |
description: "Commit sha" | |
required: true | |
jobs: | |
build-push-images: | |
runs-on: ubuntu-latest-16-cores | |
# Usually, a successful job takes ~17 mins. | |
# Anything more than 30 mins is a sign that job is stuck. | |
# This is a workaround until we find the root cause. | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: "true" | |
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.commit || '' }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
if: ${{ !env.ACT }} | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PAT }} | |
- name: Prepare build args | |
id: build_args | |
run: | | |
github_sha_short=${GITHUB_SHA:0:7} | |
echo "IMAGE_TAG=sha-${github_sha_short}" >> $GITHUB_ENV | |
push=${{ github.event_name == 'push' && !env.ACT }} | |
# This version is used for the docker compose cluster | |
echo "TEMPORAL_VERSION=${github_sha_short}" >> $GITHUB_ENV | |
TEMPORAL_SHA=$(git submodule status -- temporal | awk '{print $1}') | |
echo "TEMPORAL_SHA=${TEMPORAL_SHA}" >> $GITHUB_ENV | |
TCTL_SHA=$(git submodule status -- tctl | awk '{print $1}') | |
echo "TCTL_SHA=${TCTL_SHA}" >> $GITHUB_ENV | |
TAG_LATEST=${{(github.event_name == 'push' && github.ref == 'refs/heads/main') && 'true' || 'false'}} | |
echo "TAG_LATEST=${TAG_LATEST}" >> $GITHUB_ENV | |
# Cache params are a bit of a pain | |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
cachefor () { | |
echo "$1.cache-from=type=local,src=/tmp/.buildx-cache/$1" | |
echo "$1.cache-to=type=local,dest=/tmp/.buildx-cache-new/$1" | |
} | |
echo 'cache_params<<EOF' >> $GITHUB_OUTPUT | |
for img in server admin-tools auto-setup; do | |
cachefor $img >> $GITHUB_OUTPUT | |
done | |
echo 'EOF' >> $GITHUB_OUTPUT | |
cat $GITHUB_OUTPUT | |
- name: Restore Cached Docker Layers | |
id: restore-cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-cache-go-build-${{ hashFiles('**/go.sum') }}-${{steps.build_args.outputs.branch}} | |
restore-keys: | | |
${{ runner.os }}-cache-go-build-${{ hashFiles('**/go.sum') }}- | |
${{ runner.os }}-cache-go-build- | |
### BUILD & PUSH SERVER IMAGE ### | |
- name: Metatags for the Server image | |
id: meta_server | |
uses: docker/metadata-action@v5 | |
with: | |
images: temporaliotest/server | |
tags: | | |
type=sha,format=short,event=branch | |
latest | |
- name: Build-Push Server image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: ${{steps.build_args.outputs.push == 'true'}} | |
file: server.Dockerfile | |
build-args: | | |
TEMPORAL_SHA=${{ steps.build_args.outputs.TEMPORAL_SHA }} | |
TCTL_SHA=${{ steps.build_args.outputs.TCTL_SHA }} | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta_server.outputs.tags }} | |
labels: ${{ steps.meta_server.outputs.labels }} | |
- name: Run Trivy vulnerability scanner on Server image | |
uses: ./.github/actions/trivy | |
with: | |
image-tags: ${{ steps.meta_server.outputs.tags }} | |
image-name: server | |
### BUILD & PUSH ADMIN TOOLS IMAGE ### | |
- name: Metatags for the Admin Tools image | |
id: meta_admin_tools | |
if: steps.build_args.outputs.push == 'true' | |
uses: docker/metadata-action@v5 | |
with: | |
images: temporaliotest/admin-tools | |
tags: | | |
type=sha,format=short,event=branch | |
latest | |
- name: Build-Push Admin Tools | |
uses: docker/build-push-action@v5 | |
if: steps.build_args.outputs.push == 'true' | |
with: | |
context: . | |
push: ${{steps.build_args.outputs.push == 'true'}} | |
file: admin-tools.Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta_admin_tools.outputs.tags }} | |
labels: ${{ steps.meta_admin_tools.outputs.labels }} | |
build-args: | | |
SERVER_IMAGE=temporaliotest/server:${{ steps.build_args.outputs.image_tag }} | |
- name: Run Trivy vulnerability scanner on Admin Tools image | |
if: steps.build_args.outputs.push == 'true' | |
uses: ./.github/actions/trivy | |
with: | |
image-tags: ${{ steps.meta_admin_tools.outputs.tags }} | |
image-name: admin-tools | |
### BUILD & PUSH AUTO SETUP IMAGE ### | |
- name: Metatags for the Auto Setup image | |
id: meta_auto_setup | |
uses: docker/metadata-action@v5 | |
if: steps.build_args.outputs.push == 'true' | |
with: | |
images: temporaliotest/auto-setup | |
tags: | | |
type=sha,format=short,event=branch | |
latest | |
- name: Build-Push Auto Setup | |
uses: docker/build-push-action@v5 | |
if: steps.build_args.outputs.push == 'true' | |
with: | |
context: . | |
push: ${{steps.build_args.outputs.push == 'true'}} | |
file: auto-setup.Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta_auto_setup.outputs.tags }} | |
labels: ${{ steps.meta_auto_setup.outputs.labels }} | |
build-args: | | |
SERVER_IMAGE=temporaliotest/server:${{ steps.build_args.outputs.image_tag }} | |
ADMIN_TOOLS_IMAGE=temporaliotest/admin-tools:${{ steps.build_args.outputs.image_tag }} | |
- name: Run Trivy vulnerability scanner on Auto Setup image | |
uses: ./.github/actions/trivy | |
if: steps.build_args.outputs.push == 'true' | |
with: | |
image-tags: ${{ steps.meta_auto_setup.outputs.tags }} | |
image-name: auto-setup | |
# This prevents the cache from growing in size indefinitely | |
- name: Move Docker Layers Cache | |
if: always() | |
run: | | |
test -d /tmp/.buildx-cache && rm -rf /tmp/.buildx-cache | |
test -d /tmp/.buildx-cache-new && mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
- name: Save Docker Layers Cache | |
uses: actions/cache/save@v3 | |
if: always() | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ steps.restore-cache.outputs.cache-primary-key }} |