From 8c9c542c401cf5523de2988d52c1711fb25d0c32 Mon Sep 17 00:00:00 2001 From: akarat Date: Tue, 20 Feb 2024 15:26:38 +0800 Subject: [PATCH] try build & push --- .github/workflows/image.yaml | 55 ++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/image.yaml diff --git a/.github/workflows/image.yaml b/.github/workflows/image.yaml new file mode 100644 index 000000000000..67126f62c9f5 --- /dev/null +++ b/.github/workflows/image.yaml @@ -0,0 +1,55 @@ +name: Docker Image +on: + push: + branches: + - "master" + - "try-ci" + tags: + - "v*.*.*" + pull_request: + branches: + - "master" + +jobs: + build: + runs-on: ubuntu-latest + permissions: + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Env + id: vars + shell: bash + run: | + echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> "${GITHUB_ENV}" + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + install: true + driver: docker + platforms: linux/arm64 + + - name: Login to GitHub Packages + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/arm64 + file: ./.docker/Dockerfile-build + push: true + tags: ghcr.io/theplant/kratos:${{ env.SHA_SHORT }} + build-args: | + COMMIT=${{ env.SHA_SHORT }} + BUILD_DATE=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")