Skip to content

💚 rename docker image #9

💚 rename docker image

💚 rename docker image #9

name: BSN Backend API Pipeline
on:
push:
branches:
- ci/pipeline
jobs:
compile:
runs-on: self-hosted
name: Compile project
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
- name: Running Unit Tests
run: |
cd book-network
./mvnw clean compile
unit-tests:
runs-on: self-hosted
name: Unit tests
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
- name: Running Unit Tests
run: |
cd book-network
./mvnw clean test
build:
runs-on: self-hosted
name: Build backend
needs: [compile, unit-tests]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
- name: Compile project
run: |
cd book-network
./mvnw clean compile
build-image:
name: Build Docker image
runs-on: self-hosted
needs: [build]
steps:
- name: Extract project version
id: extract_version
run: |
cd book-network
echo "VERSION=$(./mvnw -q -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_OUTPUT
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build & Push to DockerHub
uses: docker/build-push-action@v5
with:
context: book-network
file: docker/backend/Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/bsn-api:${{ steps.extract_version.outputs.VERSION }}
build-args: |
PROFILE: dev
APP_VERSION: ${{ steps.extract_version.outputs.VERSION }}