Merge remote-tracking branch 'upstream/main' into moeflow-companion-main #17
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 image as mit-worker | |
on: | |
workflow_call: {} | |
workflow_dispatch: {} | |
push: | |
branches: | |
- main | |
- moeflow-* | |
defaults: | |
run: | |
shell: bash | |
working-directory: . | |
jobs: | |
build-image-x64: | |
name: Build docker image (x64) | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Delete huge unnecessary tools folder | |
run: rm -rf /opt/hostedtoolcache | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-buildx-action@v2 | |
- name: Login to GHCR | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate image metadata | |
uses: docker/metadata-action@v4 | |
id: docker_meta | |
with: | |
images: ghcr.io/${{ github.repository }} | |
tags: | | |
type=ref,event=branch,enable=${{ github.ref == format('refs/heads/{0}', 'main') }},suffix=-{{sha}} | |
type=ref,event=branch,enable=${{ github.ref == format('refs/heads/{0}', 'develop') }},suffix=-{{sha}} | |
type=ref,event=pr | |
type=sha | |
- name: Build & Push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./Dockerfile.moeflow_worker | |
platforms: linux/amd64 | |
push: true | |
provenance: false | |
sbom: false | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
cache-from: type=gha,scope=mit-worker-x64 | |
cache-to: type=gha,mode=max,scope=mit-worker-x64 |