fix in Dockerfile (mysql version), docker-compose and update readme
diff --git a/src/main/resources/archetype-resources/docker-resources/db/Dockerfile b/src/main/resources/archetype-resources/docker-resources/db/Dockerfile
index 555e234..c60ad3a 100644
--- a/src/main/resources/archetype-resources/docker-resources/db/Dockerfile
+++ b/src/main/resources/archetype-resources/docker-resources/db/Dockerfile
@@ -1,7 +1,7 @@
#using multi-stage
# mariadb use docker-entrypoint
-FROM mysql:latest as builder
+FROM mysql:8.0.19 as builder
# That file does the DB initialization but also runs mysql daemon, by removing the last line it will only init
RUN ["/bin/sed", "-i", "s/exec \"$@\"/echo \"not running $@\"/", "/usr/local/bin/docker-entrypoint.sh"]
@@ -58,7 +58,7 @@
RUN ["/usr/local/bin/docker-entrypoint.sh", "mysqld", "--datadir", "/initialized-db"]
#RUN /docker-entrypoint.sh mysqld --datadir=/initialized-db && sleep 10
-FROM mysql:latest
+FROM mysql:8.0.19
# my.cnf setting data-dir
COPY --from=builder /initialized-db /var/lib/mysql
diff --git a/src/main/resources/archetype-resources/docker-resources/docker-compose.yml b/src/main/resources/archetype-resources/docker-resources/docker-compose.yml
index bbe4ca2..15bf8a2 100644
--- a/src/main/resources/archetype-resources/docker-resources/docker-compose.yml
+++ b/src/main/resources/archetype-resources/docker-resources/docker-compose.yml
@@ -29,9 +29,7 @@
volumes:
- ../:/myapp
- - "${app_volume_local_repo}:/m2repo"
- #networks:
- # - db
+ - '${app_volume_local_repo}:/m2repo'
db:
# set the build context
diff --git a/src/main/resources/archetype-resources/docker-resources/readme.md b/src/main/resources/archetype-resources/docker-resources/readme.md
index 2f4c711..7071877 100644
--- a/src/main/resources/archetype-resources/docker-resources/readme.md
+++ b/src/main/resources/archetype-resources/docker-resources/readme.md
@@ -36,7 +36,15 @@
## Check Docker Compose file (optional)
-- Check services in docker-compose.yml (volumes)
+- Check services in docker-compose.yml (volumes). You might map your local maven repostory like this:
+
+```sh
+ volumes:
+ - ../:/myapp
+ - '<localpath>:/m2repo'
+ ```yml
+
+- Check format:
```
docker-compose config
```
@@ -50,37 +58,24 @@
- Optionally Check system or cleanup, e.g. with docker-compose down, docker-compose down -v or docker sytem prune (removes any container on system).
+## Start
+
- If services are already installed, activate/start by
+
+```sh
docker-compose up
+```
- Starting the app service will build the app and start jetty with Maven on port 8081.
This command is set as a **command** in the app service in docker compose.
-If not yet done, build on the host with mvn clean install -f ../pom.xml -Pdocker.
+If not yet done, build on the host with
-### Build Services
-
-The app service uses later a volume, which maps to the local maven repository, which you may need/not need.
-The db service uses mysql-latest (currently 8.x), you may replace it with a fixed release tag, e.g. 5.6.
-
- - Build it
-
```sh
- docker-compose build --no-cache
+mvn clean install -f ../pom.xml -Pdocker
```
- .. optionally build it separately
- docker-compose build --no-cache --build-arg DB_CONTEXT=./docker-resources/db db
-
- .. building app service first/only requires removing the dependency in docker-compose.yml(comment depends_on: db)
- docker-compose build --no-cache app
-
-DB_CONTEXT is set to allow starting the db container standalone (in folder db, e.g. with docker build --tag my-db .)
-to test it. CAVEAT: The db service is build and populated until now with hard coded data.
-It is a dependency for the service app (see app/Dockerfile).
-
-
-### Starting Services
+### Start and Stopp the service
Start both services in one step
```
@@ -93,8 +88,29 @@
```
This will start first the db service, then the app service. Jetty is run exposing the webapp to **http://localhost:8081/app**.
+
+Login should work with user admin/password or user/password.
+
+
By default remote debugging is activated (port 9000), which could be removed/commented in docker-compose.yml.
-You could follow the logs with docker-compose logs -f app or docker-compose logs -f db.
+
+You could follow the logs (in folder docker-resources) with
+
+``` sh
+docker-compose logs -f app
+```
+
+ or
+
+``` sh
+ docker-compose logs -f db.
+ ```
+
+Stop by Ctrl-C or
+```
+docker-compose down
+```
+
#### Lifecycle (developers only)
@@ -127,6 +143,31 @@
ls -la /myapp // should list pom.xml ...
```
+
+### Build Services
+
+The app service uses later a volume, which maps to the local maven repository, which you may need/not need.
+The db service uses mysql (currently 8.0.x), you may replace it with a fixed release tag, e.g. 5.6.
+
+In any case, you need then to rebuild the image.
+
+
+ - Build the image
+
+```sh
+ docker-compose build --no-cache
+```
+
+ .. optionally build it separately
+ docker-compose build --no-cache --build-arg DB_CONTEXT=./docker-resources/db db
+
+ .. building app service first/only requires removing the dependency in docker-compose.yml(comment depends_on: db)
+ docker-compose build --no-cache app
+
+DB_CONTEXT is set to allow starting the db container standalone (in folder db, e.g. with docker build --tag my-db .)
+to test it. CAVEAT: The db service is build and populated until now with hard coded data.
+It is a dependency for the service app (see app/Dockerfile).
+
# System Specific Informations
## Windows