Docker composeLink
In the following sections we will propose several use cases combining docker images thanks to docker-compose
.
Note
You need docker-compose
installed, see here.
Database & plant 3D explorerLink
To use your own local database, we provide a docker compose recipe that:
- start a database container using
roboticsmicrofarms/plantdb
- start a plant-3d-explorer container using
roboticsmicrofarms/plant-3d-explorer
Use pre-built docker imageLink
You can use the pre-built images plantdb
& plantviewer
, accessible from the ROMI dockerhub, to easily test & use the plant 3d explorer
with your own database 1.
The docker-compose.yml
look like this:
version: '3'
services:
db:
image: "roboticsmicrofarms/plantdb"
volumes:
- ${ROMI_DB}:/myapp/db
expose:
- "5000"
healthcheck:
test: "exit 0"
viewer:
image: "roboticsmicrofarms/plant-3d-explorer"
depends_on:
- db
environment:
REACT_APP_API_URL: http://172.21.0.2:5000
ports:
- "3000:3000"
From the root directory of plant-3d-explorer
containing the docker-compose.yml
in a terminal:
export ROMI_DB=<path/to/db>
docker-compose up -d
Important
Do not forget to set the path to the database.
Warning
If you have other containers running it might not work since it assumes the plantdb container will have the 172.21.0.2
IP address!
To stop the containers:
docker-compose stop
Note
To use local builds, change the image
YAML parameter to match your images names & tag.
Force local buildsLink
To force builds at compose startup, for development or debugging purposes, use the build
YAML parameter instead of image
2.
It is possible to keep the image
YAML parameter to tag the built images 3.
The docker-compose.yml
should look like this:
version: '3'
services:
db:
build: ../plantdb/.
image: db:debug
volumes:
- ${ROMI_DB}:/myapp/db
expose:
- "5000"
healthcheck:
test: "exit 0"
viewer:
build: ../developer
image: viewer:debug
depends_on:
- db
environment:
REACT_APP_API_URL: http://172.21.0.2:5000
ports:
- "3000:3000"
Warning
This assumes that you have to plantdb
repository cloned next to the one of plant-3d-explorer
.