mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-17 13:25:49 +00:00
Added Docker workflow
This commit is contained in:
parent
5ce47b026b
commit
067e66e2fa
1 changed files with 35 additions and 0 deletions
35
.github/workflows/docker-build.yml
vendored
Normal file
35
.github/workflows/docker-build.yml
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: 🧾 Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: ☕ Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '17'
|
||||
|
||||
- name: 🧱 Build with Gradle
|
||||
run: ./gradlew build
|
||||
|
||||
- name: 🔐 Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: 🐳 Build and Tag Docker Image
|
||||
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/spring-petclinic:latest .
|
||||
|
||||
- name: 🚀 Push Docker Image
|
||||
run: docker push ${{ secrets.DOCKER_USERNAME }}/spring-petclinic:latest
|
||||
|
Loading…
Reference in a new issue