docker image name #2
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
on: | |
- push | |
jobs: | |
app-backend: | |
env: | |
REGISTRY: ghcr.io | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./backend | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install JDK21 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: "temurin" # See 'Supported distributions' for available options | |
java-version: "21" | |
- run: ./gradlew bootJar -x test | |
- name: Get short SHA | |
id: sha | |
run: echo "::set-output name=short::$(echo ${GITHUB_SHA} | cut -c 1-7)" | |
- name: Build and Push | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./backend | |
dockerfile: Dockerfile | |
platforms: linux/amd64,linux/arm64/v8 | |
push: true | |
tags: | | |
ghcr.io/${{ github.actor }}/tanstack-router-demo-backend:latest | |
ghcr.io/${{ github.actor }}/tanstack-router-demo-backend:${{ steps.sha.outputs.short }} |