From 186fde09edaa87b3c06a6bab8d29384f5251b832 Mon Sep 17 00:00:00 2001 From: Marty30 Date: Tue, 20 Jun 2017 09:25:44 +0200 Subject: [PATCH] Docker configuration --- Dockerfile | 17 +++++++++++++++++ docker-compose.yml | 27 ++++++++++++++++++--------- 2 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..a1c890445 --- /dev/null +++ b/Dockerfile @@ -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" ] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 1631ec9fa..b2c662c3f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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" \ No newline at end of file +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" \ No newline at end of file