Skip to content

v0.38.5

v0.38.5 #470

Workflow file for this run

name: Build and Push Images
on:
workflow_call:
push:
branches:
- main
paths-ignore:
- "README.md"
tags:
- "*-rc*"
release:
types: [published]
jobs:
build-amd64:
runs-on: ubuntu-24.04
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
overprovision-lvm: "true"
remove-dotnet: "true"
build-mount-path: "/var/lib/docker/"
- name: Restart docker
run: sudo service docker restart
- uses: actions/checkout@v4
with:
token: ${{ secrets.botGitHubToken }}
- name: Load .env file
uses: cardinalby/export-env-action@v2
with:
envFile: .env
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: dropletbot
password: ${{ secrets.BOTDOCKERHUBPERSONALACCESSTOKEN }}
- name: Set short commit SHA
if: github.ref == 'refs/heads/main'
run: |
echo "COMMIT_SHORT_SHA=${GITHUB_SHA:0:7}" >> $GITHUB_ENV
- name: Build and push amd64 (commit hash)
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
context: .
push: true
build-args: |
SERVICE_NAME=${{ env.SERVICE_NAME }}
SERVICE_VERSION=${{ env.COMMIT_SHORT_SHA }}
tags: instill/${{ env.SERVICE_NAME }}:${{ env.COMMIT_SHORT_SHA }}-amd64
cache-from: type=registry,ref=instill/${{ env.SERVICE_NAME }}:buildcache
cache-to: type=registry,ref=instill/${{ env.SERVICE_NAME }}:buildcache,mode=max
- name: Set Versions
if: github.event_name == 'release' || startsWith(github.ref, 'refs/tags/')
uses: actions/github-script@v6
id: set_version
with:
script: |
const tag = '${{ github.ref_name }}'
const no_v_tag = tag.replace('v', '')
core.setOutput('tag', tag)
core.setOutput('no_v_tag', no_v_tag)
- name: Build and push amd64 (rc/release)
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'release'
uses: docker/build-push-action@v6
with:
platforms: linux/amd64
context: .
push: true
build-args: |
SERVICE_NAME=${{ env.SERVICE_NAME }}
SERVICE_VERSION=${{ steps.set_version.outputs.no_v_tag }}
tags: instill/${{ env.SERVICE_NAME }}:${{ steps.set_version.outputs.no_v_tag }}-amd64
cache-from: type=registry,ref=instill/${{ env.SERVICE_NAME }}:buildcache
cache-to: type=registry,ref=instill/${{ env.SERVICE_NAME }}:buildcache,mode=max
build-arm64:
runs-on: ubuntu-24.04-arm
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
overprovision-lvm: "true"
remove-dotnet: "true"
build-mount-path: "/var/lib/docker/"
- name: Restart docker
run: sudo service docker restart
- uses: actions/checkout@v4
with:
token: ${{ secrets.botGitHubToken }}
- name: Load .env file
uses: cardinalby/export-env-action@v2
with:
envFile: .env
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: dropletbot
password: ${{ secrets.BOTDOCKERHUBPERSONALACCESSTOKEN }}
- name: Set short commit SHA
if: github.ref == 'refs/heads/main'
run: |
echo "COMMIT_SHORT_SHA=${GITHUB_SHA:0:7}" >> $GITHUB_ENV
- name: Build and push arm64 (commit hash)
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v6
with:
platforms: linux/arm64
context: .
push: true
build-args: |
SERVICE_NAME=${{ env.SERVICE_NAME }}
SERVICE_VERSION=${{ env.COMMIT_SHORT_SHA }}
tags: instill/${{ env.SERVICE_NAME }}:${{ env.COMMIT_SHORT_SHA }}-arm64
cache-from: type=registry,ref=instill/${{ env.SERVICE_NAME }}:buildcache
cache-to: type=registry,ref=instill/${{ env.SERVICE_NAME }}:buildcache,mode=max
- name: Set Versions
if: github.event_name == 'release' || startsWith(github.ref, 'refs/tags/')
uses: actions/github-script@v6
id: set_version
with:
script: |
const tag = '${{ github.ref_name }}'
const no_v_tag = tag.replace('v', '')
core.setOutput('tag', tag)
core.setOutput('no_v_tag', no_v_tag)
- name: Build and push arm64 (rc/release)
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'release'
uses: docker/build-push-action@v6
with:
platforms: linux/arm64
context: .
push: true
build-args: |
SERVICE_NAME=${{ env.SERVICE_NAME }}
SERVICE_VERSION=${{ steps.set_version.outputs.no_v_tag }}
tags: instill/${{ env.SERVICE_NAME }}:${{ steps.set_version.outputs.no_v_tag }}-arm64
cache-from: type=registry,ref=instill/${{ env.SERVICE_NAME }}:buildcache
cache-to: type=registry,ref=instill/${{ env.SERVICE_NAME }}:buildcache,mode=max
combine-and-push:
needs: [build-amd64, build-arm64]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.botGitHubToken }}
- name: Load .env file
uses: cardinalby/export-env-action@v2
with:
envFile: .env
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: dropletbot
password: ${{ secrets.BOTDOCKERHUBPERSONALACCESSTOKEN }}
- name: Set short commit SHA
if: github.ref == 'refs/heads/main'
run: |
echo "COMMIT_SHORT_SHA=${GITHUB_SHA:0:7}" >> $GITHUB_ENV
- name: Create and push multi-arch manifest (commit hash)
if: github.ref == 'refs/heads/main'
run: |
docker buildx imagetools create -t instill/${{ env.SERVICE_NAME }}:${{ env.COMMIT_SHORT_SHA }} \
instill/${{ env.SERVICE_NAME }}:${{ env.COMMIT_SHORT_SHA }}-amd64 \
instill/${{ env.SERVICE_NAME }}:${{ env.COMMIT_SHORT_SHA }}-arm64
- name: Create and push multi-arch manifest (latest)
if: github.ref == 'refs/heads/main'
run: |
docker buildx imagetools create -t instill/${{ env.SERVICE_NAME }}:latest \
instill/${{ env.SERVICE_NAME }}:${{ env.COMMIT_SHORT_SHA }}-amd64 \
instill/${{ env.SERVICE_NAME }}:${{ env.COMMIT_SHORT_SHA }}-arm64
- name: Set Versions
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'release'
uses: actions/github-script@v6
id: set_version
with:
script: |
const tag = '${{ github.ref_name }}'
const no_v_tag = tag.replace('v', '')
core.setOutput('tag', tag)
core.setOutput('no_v_tag', no_v_tag)
- name: Create and push multi-arch manifest (rc/release)
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'release'
run: |
docker buildx imagetools create -t instill/${{ env.SERVICE_NAME }}:${{ steps.set_version.outputs.no_v_tag }} \
instill/${{ env.SERVICE_NAME }}:${{ steps.set_version.outputs.no_v_tag }}-amd64 \
instill/${{ env.SERVICE_NAME }}:${{ steps.set_version.outputs.no_v_tag }}-arm64