Skip to content

fixes

fixes #252

name: Docker Build and Push
on:
push:
branches:
- main
jobs:
unit-testing:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Java 22
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 22
- name: Build and test with Maven and profile ut
run: |
cd backend
mvn clean test -Dspring.profiles.active=ut
build-and-push-backend:
runs-on: ubuntu-latest
needs: unit-testing
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push multi-platform image
uses: docker/build-push-action@v6
with:
context: ./backend
push: true
platforms: linux/amd64,linux/arm64
tags: |
mixeway/flow-api:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push multi-platform image to GHCR
uses: docker/build-push-action@v6
with:
context: ./backend
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/mixeway/flow-api:latest
cache-from: type=gha
cache-to: type=gha,mode=max