mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-19 14:05:50 +00:00
Evgeny Subotin test commit
This commit is contained in:
parent
60105d5d9a
commit
60cd2c5d9e
8 changed files with 202 additions and 0 deletions
13
Dockerfile
Normal file
13
Dockerfile
Normal file
|
@ -0,0 +1,13 @@
|
|||
FROM ubuntu:latest
|
||||
MAINTAINER evgenyidf <evgenyidf@gmail.com>
|
||||
|
||||
RUN apt-get update --fix-missing && apt-get install -y default-jre
|
||||
|
||||
RUN mkdir /var/spring-petclinic
|
||||
COPY target/spring-petclinic*.jar /var/spring-petclinic/spring-petclinic.jar
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
VOLUME [".", "/"]
|
||||
|
||||
CMD ["java -jar /var/spring-petclinic/spring-petclinic.jar"]
|
28
Jenkinsfile
vendored
Normal file
28
Jenkinsfile
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
pipeline {
|
||||
agent { docker { image 'maven:3.3.3' } }
|
||||
stages {
|
||||
stage('build and test') {
|
||||
steps {
|
||||
echo 'Building..'
|
||||
}
|
||||
steps {
|
||||
sh 'mvn package'
|
||||
}
|
||||
}
|
||||
stage('docker image build') {
|
||||
steps {
|
||||
echo 'Docker compose..'
|
||||
}
|
||||
steps {
|
||||
sh 'docker-compose down && docker-compose up --build -d'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
failure {
|
||||
mail bcc: '', body: "<b>Example</b><br>\n\<br>Project: ${env.JOB_NAME} <br>Build Number: ${env.BUILD_NUMBER} <br> URL de build: ${env.BUILD_URL}", cc: '', charset: 'UTF-8', from: '', mimeType: 'text/html', replyTo: '', subject: "ERROR CI: Project name -> ${env.JOB_NAME}", to: "foo@gmail.com";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,3 +1,12 @@
|
|||
jenkins:
|
||||
image: jenkinsci/blueocean
|
||||
ports:
|
||||
- "8081:8080"
|
||||
- "50000:50000"
|
||||
environment:
|
||||
- jenkins-data=/var/jenkins_home
|
||||
|
||||
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
ports:
|
||||
|
@ -7,3 +16,21 @@ mysql:
|
|||
- MYSQL_DATABASE=petclinic
|
||||
volumes:
|
||||
- "./conf.d:/etc/mysql/conf.d:ro"
|
||||
|
||||
petclinic1:
|
||||
build: .
|
||||
ports:
|
||||
- "8082:8080"
|
||||
|
||||
petclinic2:
|
||||
build: .
|
||||
ports:
|
||||
- "8083:8080"
|
||||
|
||||
nginx:
|
||||
build: ./nginx
|
||||
links:
|
||||
- petclinic1:petclinic1
|
||||
- petclinic2:petclinic2
|
||||
ports:
|
||||
- "8080:8080"
|
||||
|
|
6
nginx/Dockerfile
Normal file
6
nginx/Dockerfile
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Set nginx base image
|
||||
FROM nginx:latest
|
||||
MAINTAINER evgenyidf <evgenyidf@gmail.com>
|
||||
|
||||
# Copy custom configuration file from the current directory
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
21
nginx/nginx.conf
Normal file
21
nginx/nginx.conf
Normal file
|
@ -0,0 +1,21 @@
|
|||
events {
|
||||
worker_connections 4096; ## Default: 1024
|
||||
}
|
||||
|
||||
http {
|
||||
|
||||
upstream localhost {
|
||||
# These are references to our backend containers, facilitated by
|
||||
# Compose, as defined in docker-compose.yml
|
||||
server petclinic1:8082;
|
||||
server petclinic2:8083;
|
||||
}
|
||||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
location / {
|
||||
proxy_pass http://localhost;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
}
|
||||
}
|
84
pom.xml
84
pom.xml
|
@ -7,6 +7,9 @@
|
|||
<artifactId>spring-petclinic</artifactId>
|
||||
<version>2.0.0.BUILD-SNAPSHOT</version>
|
||||
|
||||
<!-- Output to jar format -->
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
|
@ -17,6 +20,11 @@
|
|||
<properties>
|
||||
|
||||
<!-- Generic properties -->
|
||||
<jdk.version>1.8</jdk.version>
|
||||
<jodatime.version>2.5</jodatime.version>
|
||||
<junit.version>4.12</junit.version>
|
||||
<log4j.version>1.2.17</log4j.version>
|
||||
|
||||
<java.version>1.8</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
|
@ -108,6 +116,31 @@
|
|||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time</artifactId>
|
||||
<version>${jodatime.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -202,7 +235,58 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
||||
<!-- Set a JDK compiler level -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>${jdk.version}</source>
|
||||
<target>${jdk.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- Make this jar executable -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>**/log4j.properties</exclude>
|
||||
</excludes>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addClasspath>true</addClasspath>
|
||||
<mainClass>org.springframework.samples.petclinic.PetClinicApplication</mainClass>
|
||||
<classpathPrefix>dependency-jars/</classpathPrefix>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- Copy project dependency -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-dependencies</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<!-- exclude junit, we need runtime dependency only -->
|
||||
<includeScope>runtime</includeScope>
|
||||
<outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
||||
<!-- Apache 2 license -->
|
||||
|
|
16
src/Dockerfile
Normal file
16
src/Dockerfile
Normal file
|
@ -0,0 +1,16 @@
|
|||
FROM ubuntu:latest
|
||||
MAINTAINER evgenyidf <evgenyidf@gmail.com>
|
||||
|
||||
RUN apt-get update --fix-missing && apt-get install -y default-jre
|
||||
|
||||
RUN mkdir -p /var/spring-petclinic/jars
|
||||
|
||||
WORKDIR /var/spring-petclinic
|
||||
COPY ../target/spring-petclinic*.jar /var/spring-petclinic/spring-petclinic.jar
|
||||
COPY ../target/dependency-jars/*.jar /var/spring-petclinic/jars
|
||||
|
||||
RUN ls -la /var/spring-petclinic/spring-petclinic-2.0.0.BUILD-SNAPSHOT.jar
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
#ENTRYPOINT ["java -cp /var/spring-petclinic.jar"]
|
7
src/main/resources/log4j.properties
Normal file
7
src/main/resources/log4j.properties
Normal file
|
@ -0,0 +1,7 @@
|
|||
# Root logger option
|
||||
log4j.rootLogger=DEBUG, stdout
|
||||
|
||||
# Direct log messages to stdout
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
|
Loading…
Reference in a new issue