mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-27 09:25:49 +00:00
better layer caching & multi-stage build
This commit is contained in:
parent
131e96b7a2
commit
a666c41a62
2 changed files with 15 additions and 10 deletions
21
Dockerfile
21
Dockerfile
|
@ -1,11 +1,16 @@
|
||||||
FROM openjdk:latest
|
FROM openjdk:8-jdk-alpine AS build
|
||||||
|
WORKDIR /build
|
||||||
WORKDIR /tmp/
|
COPY .mvn .mvn
|
||||||
|
COPY mvnw .
|
||||||
COPY . .
|
COPY mvnw.cmd .
|
||||||
|
COPY pom.xml .
|
||||||
|
RUN ./mvnw -B -e dependency:go-offline
|
||||||
|
COPY src src
|
||||||
RUN ./mvnw package
|
RUN ./mvnw package
|
||||||
|
|
||||||
|
FROM openjdk:8-jre-alpine
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
ENTRYPOINT [ "java" ]
|
||||||
CMD ./mvnw spring-boot:run -Dspring-boot.run.profiles=mysql
|
CMD [ "-jar", "-Dspring.profiles.active=mysql" ,"app.jar" ]
|
||||||
|
COPY --from=build /build/target/*.jar /app/app.jar
|
||||||
|
WORKDIR /app
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: hllvc/spring-petclinic:latest
|
image: hllvc/spring-petclinic:latest
|
||||||
ports:
|
|
||||||
- "3000:8080"
|
|
||||||
links:
|
links:
|
||||||
- mysql:mysql
|
- mysql:mysql
|
||||||
|
ports:
|
||||||
|
- "3000:8080"
|
||||||
mysql:
|
mysql:
|
||||||
image: mysql:5.7
|
image: mysql:5.7
|
||||||
ports:
|
ports:
|
||||||
|
|
Loading…
Reference in a new issue