diff --git a/README.md b/README.md
index 231a89005..c40425c10 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,8 @@ Alternatively you can also build all the images on Podman, which requires Podman
Once images are ready, you can start them with a single command
`docker-compose up` or `podman-compose up`.
-Containers startup order is coordinated with [`dockerize` script](https://github.com/jwilder/dockerize).
+Containers startup order is coordinated with the `service_healthy` condition of the Docker Compose [depends-on](https://github.com/compose-spec/compose-spec/blob/master/spec.md#depends_on) expression
+and the [healthcheck](https://github.com/compose-spec/compose-spec/blob/master/spec.md#healthcheck) of the service containers.
After starting services, it takes a while for API Gateway to be in sync with service registry,
so don't be scared of initial Spring Cloud Gateway timeouts. You can track services availability using Eureka dashboard
available by default at http://localhost:8761.
diff --git a/docker-compose.yml b/docker-compose.yml
index c06448582..49ab25958 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,71 +1,106 @@
-version: '2'
+version: '3'
services:
config-server:
image: springcommunity/spring-petclinic-config-server
container_name: config-server
- mem_limit: 512M
+ deploy:
+ resources:
+ limits:
+ memory: 512M
+ healthcheck:
+ test: ["CMD", "curl", "-I", "http://config-server:8888"]
+ interval: 5s
+ timeout: 5s
+ retries: 10
ports:
- 8888:8888
discovery-server:
image: springcommunity/spring-petclinic-discovery-server
container_name: discovery-server
- mem_limit: 512M
+ deploy:
+ resources:
+ limits:
+ memory: 512M
+ healthcheck:
+ test: ["CMD", "curl", "-f", "http://discovery-server:8761"]
+ interval: 5s
+ timeout: 3s
+ retries: 10
depends_on:
- - config-server
- entrypoint: ["./dockerize","-wait=tcp://config-server:8888","-timeout=60s","--","java", "org.springframework.boot.loader.JarLauncher"]
+ config-server:
+ condition: service_healthy
ports:
- 8761:8761
customers-service:
image: springcommunity/spring-petclinic-customers-service
container_name: customers-service
- mem_limit: 512M
+ deploy:
+ resources:
+ limits:
+ memory: 512M
depends_on:
- - config-server
- - discovery-server
- entrypoint: ["./dockerize","-wait=tcp://discovery-server:8761","-timeout=60s","--","java", "org.springframework.boot.loader.JarLauncher"]
+ config-server:
+ condition: service_healthy
+ discovery-server:
+ condition: service_healthy
ports:
- 8081:8081
visits-service:
image: springcommunity/spring-petclinic-visits-service
container_name: visits-service
- mem_limit: 512M
+ deploy:
+ resources:
+ limits:
+ memory: 512M
depends_on:
- - config-server
- - discovery-server
- entrypoint: ["./dockerize","-wait=tcp://discovery-server:8761","-timeout=60s","--","java", "org.springframework.boot.loader.JarLauncher"]
+ config-server:
+ condition: service_healthy
+ discovery-server:
+ condition: service_healthy
ports:
- 8082:8082
vets-service:
image: springcommunity/spring-petclinic-vets-service
container_name: vets-service
- mem_limit: 512M
+ deploy:
+ resources:
+ limits:
+ memory: 512M
depends_on:
- - config-server
- - discovery-server
- entrypoint: ["./dockerize","-wait=tcp://discovery-server:8761","-timeout=60s","--","java", "org.springframework.boot.loader.JarLauncher"]
+ config-server:
+ condition: service_healthy
+ discovery-server:
+ condition: service_healthy
ports:
- 8083:8083
api-gateway:
image: springcommunity/spring-petclinic-api-gateway
container_name: api-gateway
- mem_limit: 512M
+ deploy:
+ resources:
+ limits:
+ memory: 512M
depends_on:
- - config-server
- - discovery-server
- entrypoint: ["./dockerize","-wait=tcp://discovery-server:8761","-timeout=60s","--","java", "org.springframework.boot.loader.JarLauncher"]
+ config-server:
+ condition: service_healthy
+ discovery-server:
+ condition: service_healthy
ports:
- 8080:8080
tracing-server:
image: openzipkin/zipkin
container_name: tracing-server
- mem_limit: 512M
+ deploy:
+ resources:
+ limits:
+ memory: 512M
environment:
- JAVA_OPTS=-XX:+UnlockExperimentalVMOptions -Djava.security.egd=file:/dev/./urandom
ports:
@@ -74,11 +109,15 @@ services:
admin-server:
image: springcommunity/spring-petclinic-admin-server
container_name: admin-server
- mem_limit: 512M
+ deploy:
+ resources:
+ limits:
+ memory: 512M
depends_on:
- - config-server
- - discovery-server
- entrypoint: ["./dockerize","-wait=tcp://discovery-server:8761","-timeout=60s","--","java", "org.springframework.boot.loader.JarLauncher"]
+ config-server:
+ condition: service_healthy
+ discovery-server:
+ condition: service_healthy
ports:
- 9090:9090
@@ -87,13 +126,19 @@ services:
grafana-server:
build: ./docker/grafana
container_name: grafana-server
- mem_limit: 256M
+ deploy:
+ resources:
+ limits:
+ memory: 256M
ports:
- 3000:3000
prometheus-server:
build: ./docker/prometheus
container_name: prometheus-server
- mem_limit: 256M
+ deploy:
+ resources:
+ limits:
+ memory: 256M
ports:
- 9091:9090
diff --git a/docker/Dockerfile b/docker/Dockerfile
index be157c33f..b9f789b63 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -4,20 +4,10 @@ ARG ARTIFACT_NAME
COPY ${ARTIFACT_NAME}.jar application.jar
RUN java -Djarmode=layertools -jar application.jar extract
-# Download dockerize and cache that layer
-ARG DOCKERIZE_VERSION
-RUN wget -O dockerize.tar.gz https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-alpine-linux-amd64-${DOCKERIZE_VERSION}.tar.gz
-RUN tar xzf dockerize.tar.gz
-RUN chmod +x dockerize
-
FROM eclipse-temurin:17
-
WORKDIR application
-# Dockerize
-COPY --from=builder application/dockerize ./
-
ARG EXPOSED_PORT
EXPOSE ${EXPOSED_PORT}
diff --git a/pom.xml b/pom.xml
index d07231ba2..af085bafc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,7 +39,6 @@
springcommunity
9090
${basedir}
- v0.6.1
docker
@@ -153,8 +152,6 @@
ARTIFACT_NAME=${project.build.finalName}
--build-arg
EXPOSED_PORT=${docker.image.exposed.port}
- --build-arg
- DOCKERIZE_VERSION=${docker.image.dockerize.version}
-t
${docker.image.prefix}/${project.artifactId}
${project.build.directory}