mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-17 21:15:50 +00:00
Docker configuration
This commit is contained in:
parent
ffa967c94b
commit
186fde09ed
2 changed files with 35 additions and 9 deletions
17
Dockerfile
Normal file
17
Dockerfile
Normal 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" ]
|
|
@ -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"
|
Loading…
Reference in a new issue