Update SparkJava samples

Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
This commit is contained in:
Guillaume Lours
2020-03-17 15:30:49 +01:00
parent fdc1e84d85
commit 3f8a58ef62
9 changed files with 41 additions and 33 deletions

View File

@@ -21,14 +21,14 @@ services:
backend:
build: backend
ports:
- 80:8080
- 8080:8080
db:
image: mysql:5.7
image: mysql:8.0.19
...
```
The compose file defines an application with two services `backend` and `db`.
When deploying the application, docker-compose maps port 8080 of the backend service container to port 80 of the host as specified in the file.
Make sure port 80 on the host is not already being in use.
Make sure port 8080 on the host is not already being in use.
## Deploy with docker-compose
@@ -49,13 +49,13 @@ Listing containers must show two containers running and the port mapping as belo
```
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ee1e4f05d9f6 sparkjava-mysql_backend "/bin/sh -c 'java -j…" 44 seconds ago Up 43 seconds 0.0.0.0:80->8080/tcp sparkjava-mysql_backend_1
716025ddf65b mysql:5.7 "docker-entrypoint.s…" 44 seconds ago Up 43 seconds 3306/tcp, 33060/tcp sparkjava-mysql_db_1
ee1e4f05d9f6 sparkjava-mysql_backend "/bin/sh -c 'java -j…" 44 seconds ago Up 43 seconds 0.0.0.0:8080->8080/tcp sparkjava-mysql_backend_1
716025ddf65b mysql:8.0.19 "docker-entrypoint.s…" 44 seconds ago Up 43 seconds 3306/tcp, 33060/tcp sparkjava-mysql_db_1
```
After the application starts, run:
```
$ curl localhost:80
$ curl localhost:8080
["Blog post #0","Blog post #1","Blog post #2","Blog post #3","Blog post #4"]
```