springboot_demo/README.md

1.7 KiB

Demo Springboot

1- Cloner ce repo

2- Dans le répertoire springboot_demo , Build de l'image

docker build -t <votre repo>/stringboot-rest:v1.0.0

Dans mon cas:

docker build -t gitea.zen6.info/stef/springboot_demo/stringboot-rest:v1.0.0

3- Configuration de docker-compose.yaml

Modifier le nom de l'image pour indiquer votre repo local

    image: gitea.zen6.info/stef/springboot_demo/stringboot-rest:v1.0.0

En :

    image: <votre repo>/stringboot-rest:v1.0.0

Remplacer l'url stringboot.msi.stef.lan par votre url

4- Push de l'image

docker push  <votre repo>//stringboot-rest:v1.0.0

Dans mon cas:

docker push gitea.zen6.info/stef/springboot_demo/stringboot-rest:v1.0.0

5- Deployment

cd ..
docker compose deploy --compose-file springboot_demo/docker-compose.yaml springboot_demo

6- Vérification

docker stack  ps springboot_demo
ID             NAME                           IMAGE                                                         NODE           DESIRED STATE   CURRENT STATE            ERROR     PORTS
6rnc3lh552rh   springboot_demo_stringboot.1   gitea.zen6.info/stef/springboot_demo/stringboot-rest:v1.0.0   swarm-node04   Running         Running 22 minutes ago
ghviv6par27y   springboot_demo_stringboot.2   gitea.zen6.info/stef/springboot_demo/stringboot-rest:v1.0.0   swarm-node03   Running         Running 22 minutes ago
xm91h85odf49   springboot_demo_stringboot.3   gitea.zen6.info/stef/springboot_demo/stringboot-rest:v1.0.0   swarm-node02   Running         Running 22 minutes ago

Test url:

curl https://springboot.msi.stef.lan
{"id":32,"content":"Hello, World!"}
curl https://springboot.msi.stef.lan/?name=stef
{"id":31,"content":"Hello, stef!"}