mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-22 15:55:49 +00:00
Use containers for development
This commit is contained in:
parent
5695534817
commit
74ab50beef
2 changed files with 44 additions and 5 deletions
16
Dockerfile
16
Dockerfile
|
@ -1,13 +1,19 @@
|
|||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM eclipse-temurin:17-jdk-jammy
|
||||
|
||||
FROM eclipse-temurin:17-jdk-jammy as base
|
||||
WORKDIR /app
|
||||
|
||||
COPY .mvn/ .mvn
|
||||
COPY mvnw pom.xml ./
|
||||
RUN ./mvnw dependency:resolve
|
||||
|
||||
COPY src ./src
|
||||
|
||||
CMD ["./mvnw", "spring-boot:run", "-Dspring-boot.run.profiles=mysql"]
|
||||
FROM base as development
|
||||
CMD ["./mvnw", "spring-boot:run", "-Dspring-boot.run.profiles=mysql", "-Dspring-boot.run.jvmArguments='-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8000'"]
|
||||
|
||||
FROM base as build
|
||||
RUN ./mvnw package
|
||||
|
||||
FROM eclipse-temurin:17-jre-jammy as production
|
||||
EXPOSE 8080
|
||||
COPY --from=build /app/target/spring-petclinic-*.jar /spring-petclinic.jar
|
||||
CMD ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/spring-petclinic.jar"]
|
33
docker-compose.dev.yml
Normal file
33
docker-compose.dev.yml
Normal file
|
@ -0,0 +1,33 @@
|
|||
version: '3.8'
|
||||
services:
|
||||
petclinic:
|
||||
build:
|
||||
context: .
|
||||
target: development
|
||||
ports:
|
||||
- "8000:8000"
|
||||
- "8080:8080"
|
||||
environment:
|
||||
- SERVER_PORT=8080
|
||||
- MYSQL_URL=jdbc:mysql://mysqlserver/petclinic
|
||||
volumes:
|
||||
- ./:/app
|
||||
depends_on:
|
||||
- mysqlserver
|
||||
|
||||
mysqlserver:
|
||||
image: mysql:8.0
|
||||
ports:
|
||||
- "3306:3306"
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=
|
||||
- MYSQL_ALLOW_EMPTY_PASSWORD=true
|
||||
- MYSQL_USER=petclinic
|
||||
- MYSQL_PASSWORD=petclinic
|
||||
- MYSQL_DATABASE=petclinic
|
||||
volumes:
|
||||
- mysql_data:/var/lib/mysql
|
||||
- mysql_config:/etc/mysql/conf.d
|
||||
volumes:
|
||||
mysql_data:
|
||||
mysql_config:
|
Loading…
Reference in a new issue