mirror of
https://github.com/Telecominfraproject/oopt-tai.git
synced 2026-01-27 02:21:53 +00:00
60 lines
1.9 KiB
YAML
60 lines
1.9 KiB
YAML
name: publish
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
jobs:
|
|
job:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v2
|
|
- run: |
|
|
import os
|
|
ref = os.environ['GITHUB_REF']
|
|
branch = ref[11:]
|
|
with open(os.environ['GITHUB_ENV'], "a") as f:
|
|
tag = "latest" if branch == "master" else branch
|
|
f.write(f"DOCKER_IMAGE_TAG={tag}\n")
|
|
shell: python
|
|
-
|
|
name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
-
|
|
name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
-
|
|
name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKER_USER }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
-
|
|
name: Build builder
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
file: ./docker/builder.Dockerfile
|
|
tags: |
|
|
docker.io/microsonic/tai-builder:${{ env.DOCKER_IMAGE_TAG }}
|
|
push: true
|
|
cache-from: type=registry,ref=docker.io/microsonic/tai-builder:latest
|
|
cache-to: type=inline
|
|
-
|
|
name: Build container
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
build-args: |
|
|
TAI_DOCKER_BUILDER_IMAGE=docker.io/microsonic/tai-builder:${{ env.DOCKER_IMAGE_TAG }}
|
|
platforms: linux/amd64,linux/arm64
|
|
file: ./docker/run.Dockerfile
|
|
tags: |
|
|
docker.io/microsonic/tai:${{ env.DOCKER_IMAGE_TAG }}
|
|
push: true
|
|
cache-from: type=registry,ref=docker.io/microsonic/tai:latest
|
|
cache-to: type=inline
|