mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 23:05:49 +00:00
added CI
This commit is contained in:
parent
383edc1656
commit
291086370b
3 changed files with 56 additions and 0 deletions
50
.github/workflows/ci.yml
vendored
Normal file
50
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
name: CI Pipeline
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up JDK 17
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
java-version: '17'
|
||||||
|
|
||||||
|
- name: Cache Maven dependencies
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.m2/repository
|
||||||
|
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-maven-
|
||||||
|
|
||||||
|
- name: Set up PostgreSQL
|
||||||
|
uses: harmon758/postgresql-action@v1.0.0
|
||||||
|
with:
|
||||||
|
postgresql version: '13'
|
||||||
|
postgresql db: 'petclinic'
|
||||||
|
postgresql user: 'postgres'
|
||||||
|
postgresql password: 'password'
|
||||||
|
|
||||||
|
- name: Build with Maven
|
||||||
|
run: mvn clean install
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: mvn test
|
||||||
|
|
||||||
|
- name: Build Docker image
|
||||||
|
run: docker build -t petclinic-app .
|
||||||
|
|
||||||
|
- name: Push Docker image
|
||||||
|
run: docker push your-dockerhub-username/petclinic-app
|
4
Dockerfile
Normal file
4
Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
FROM openjdk:17-jdk-slim
|
||||||
|
COPY target/spring-petclinic-*.jar /app/spring-petclinic.jar
|
||||||
|
ENTRYPOINT ["java", "-jar", "/app/spring-petclinic.jar"]
|
||||||
|
|
|
@ -23,3 +23,5 @@ logging.level.org.springframework=INFO
|
||||||
|
|
||||||
# Maximum time static resources should be cached
|
# Maximum time static resources should be cached
|
||||||
spring.web.resources.cache.cachecontrol.max-age=12h
|
spring.web.resources.cache.cachecontrol.max-age=12h
|
||||||
|
|
||||||
|
server.port=8082
|
||||||
|
|
Loading…
Reference in a new issue