add dockerfiles and jenkinsfile

This commit is contained in:
rgheorghe 2023-11-13 15:01:59 +02:00
parent ad4f3e65ef
commit adadcfa0c0
1273 changed files with 1046 additions and 30 deletions

9
Dockerfile1 Normal file
View file

@ -0,0 +1,9 @@
FROM eclipse-temurin:17-jre-alpine
WORKDIR /app
COPY target/spring-petclinic-3.1.5-SNAPSHOT.jar app.jar
RUN apk update && apk add openssl
CMD ["java", "-jar", "app.jar"]

21
Dockerfile2 Normal file
View file

@ -0,0 +1,21 @@
FROM eclipse-temurin:17-jdk-alpine as build1
WORKDIR /app
COPY .mvn/ .mvn
COPY mvnw pom.xml ./
RUN ./mvnw dependency:resolve
COPY src ./src
RUN ["./mvnw", "package"]
FROM eclipse-temurin:17-jre-alpine as build2
FROM alpine
RUN apk update && apk add openssl
COPY --from=build2 /opt/java/openjdk /opt/java/openjdk
COPY --from=build1 /app/target/*.jar /app.jar
CMD ["/opt/java/openjdk/bin/java", "-jar", "/app.jar"]

14
Jenkinsfile vendored Normal file
View file

@ -0,0 +1,14 @@
pipeline{
agent any
stages {
stage ("build") {
steps {
echo "Running build automation..."
sh 'mvn checkstyle:checkstyle'
sh 'mvn verify'
sh 'mvn clean package'
sh 'docker build -t mr/spring-petclinic:${GIT_COMMIT:0:7} -f Dockerfile2 .'
}
}
}
}

View file

@ -1,20 +1,14 @@
version: "2.2"
version: "3"
services:
mysql:
image: mysql:8.0
app:
build:
context: .
dockerfile: Dockerfile2
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=
- MYSQL_ALLOW_EMPTY_PASSWORD=true
- MYSQL_USER=petclinic
- MYSQL_PASSWORD=petclinic
- MYSQL_DATABASE=petclinic
volumes:
- "./conf.d:/etc/mysql/conf.d:ro"
profiles:
- mysql
- "8080:8080"
links:
- postgres
postgres:
image: postgres:15.3
ports:
@ -23,5 +17,5 @@ services:
- POSTGRES_PASSWORD=petclinic
- POSTGRES_USER=petclinic
- POSTGRES_DB=petclinic
profiles:
- postgres
volumes:
- ./postgres-data:/var/lib/postgresql/data

31
pom.xml
View file

@ -3,18 +3,8 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.samples</groupId>
<artifactId>spring-petclinic</artifactId>
<version>3.1.5-SNAPSHOT</version>
<version>3.1.6-SNAPSHOT</version>
<packaging>jar</packaging>
<distributionManagement>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>http://localhost:8080/repository/maven-snapshots/</url>
</snapshotRepository>
<repository>
<id>nexus-releases</id>
<url>http://localhost:8080/repository/maven-releases/</url>
</repository>
</distributionManagement>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
@ -28,7 +18,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- Important for reproducible builds. Update using e.g. ./mvnw versions:set -DnewVersion=... -->
<project.build.outputTimestamp>2023-10-27T10:51:31Z</project.build.outputTimestamp>
<project.build.outputTimestamp>2023-11-13T12:41:24Z</project.build.outputTimestamp>
<!-- Web dependencies -->
<webjars-bootstrap.version>5.2.3</webjars-bootstrap.version>
@ -470,5 +460,20 @@
<url>https://github.com/surtexx/spring-petclinic.git</url>
<tag>spring-petclinic-3.1.4</tag>
</scm>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.3.1</version>
<reportSets>
<reportSet>
<reports>
<report>checkstyle</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
</project>

1
postgres-data/PG_VERSION Normal file
View file

@ -0,0 +1 @@
15

BIN
postgres-data/base/1/112 Normal file

Binary file not shown.

BIN
postgres-data/base/1/113 Normal file

Binary file not shown.

BIN
postgres-data/base/1/1247 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
postgres-data/base/1/1249 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
postgres-data/base/1/1255 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
postgres-data/base/1/1259 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
postgres-data/base/1/13393 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

BIN
postgres-data/base/1/13397 Normal file

Binary file not shown.

BIN
postgres-data/base/1/13398 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

BIN
postgres-data/base/1/13402 Normal file

Binary file not shown.

BIN
postgres-data/base/1/13403 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

BIN
postgres-data/base/1/13407 Normal file

Binary file not shown.

BIN
postgres-data/base/1/13408 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

BIN
postgres-data/base/1/13412 Normal file

Binary file not shown.

View file

View file

BIN
postgres-data/base/1/174 Normal file

Binary file not shown.

BIN
postgres-data/base/1/175 Normal file

Binary file not shown.

BIN
postgres-data/base/1/2187 Normal file

Binary file not shown.

View file

BIN
postgres-data/base/1/2228 Normal file

Binary file not shown.

View file

View file

BIN
postgres-data/base/1/2337 Normal file

Binary file not shown.

BIN
postgres-data/base/1/2579 Normal file

Binary file not shown.

BIN
postgres-data/base/1/2600 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
postgres-data/base/1/2601 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
postgres-data/base/1/2602 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
postgres-data/base/1/2603 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

BIN
postgres-data/base/1/2605 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
postgres-data/base/1/2606 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
postgres-data/base/1/2607 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
postgres-data/base/1/2608 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
postgres-data/base/1/2609 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
postgres-data/base/1/2610 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

BIN
postgres-data/base/1/2612 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

BIN
postgres-data/base/1/2615 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
postgres-data/base/1/2616 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
postgres-data/base/1/2617 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
postgres-data/base/1/2618 Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
postgres-data/base/1/2619 Normal file

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more