Docker configuration

This commit is contained in:
Marty30 2017-06-20 09:25:44 +02:00
parent ffa967c94b
commit 186fde09ed
2 changed files with 35 additions and 9 deletions

17
Dockerfile Normal file
View file

@ -0,0 +1,17 @@
FROM maven:latest
# Set the workdir
WORKDIR /app
# Copy the source to the container
COPY . .
# Build the project
RUN mvn package
# Make the jar executable
RUN sh -c 'touch target/spring-petclinic-*.jar'
#Start the project
ENV JAVA_OPTS=""
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar target/spring-petclinic-*.jar" ]

View file

@ -1,9 +1,18 @@
mysql:
image: mysql
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=test
volumes:
- "./conf.d:/etc/mysql/conf.d:ro"
version: '2'
services:
pet-clinic:
build: .
ports:
- "8080:8080"
links:
- mysql:mysql
command: java -jar ./target/*.jar
mysql:
image: mysql
ports:
- "3306:3306"
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=test
volumes:
- "./conf.d:/etc/mysql/conf.d:ro"