From d2da8d0b9abd91557ba5f23ade34778c7d12a683 Mon Sep 17 00:00:00 2001 From: noirscape Date: Mon, 6 Apr 2020 21:43:12 +0200 Subject: [PATCH] docker: Use a .env file --- .gitignore | 2 +- README.md | 6 +++--- docker-compose.example.yml => docker-compose.yml | 8 ++++---- env.example | 10 ++++++++++ 4 files changed, 18 insertions(+), 8 deletions(-) rename docker-compose.example.yml => docker-compose.yml (53%) create mode 100644 env.example diff --git a/.gitignore b/.gitignore index 4ebd0a9..f3eac34 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ node_modules yarn.lock dist mango -docker-compose.yml +.env diff --git a/README.md b/README.md index fad3c92..aa8f2a2 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,10 @@ Simply download the pre-built binary file `mango` for the latest [release](https 1. Make sure you have docker installed and running. You will also need `docker-compose` 2. Clone the repository -3. Copy `docker-compose.example.yml` to `docker-compose.yml` -4. Modify the `volumes` in `docker-compose.yml` to point the directories to desired locations on the host machine +3. Copy the `env.example` file to `.env` +4. Fill out the values in the `.env` file. Note that the main and config directories will be created if they don't already exist. The files in these folders will be owned by the root user 5. Run `docker-compose up`. This should build the docker image and start the container with Mango running inside -6. Head over to `localhost:9000` to log in +6. Head over to `localhost:9000` (or a different port if you changed it) to log in ### Docker (via Dockerhub) diff --git a/docker-compose.example.yml b/docker-compose.yml similarity index 53% rename from docker-compose.example.yml rename to docker-compose.yml index 7ac0d6c..f5761e3 100644 --- a/docker-compose.example.yml +++ b/docker-compose.yml @@ -7,9 +7,9 @@ services: context: . dockerfile: ./Dockerfile expose: - - 9000 + - ${PORT} ports: - - 9000:9000 + - "${PORT}:9000" volumes: - - ~/mango:/root/mango - - ~/.config/mango:/root/.config/mango + - ${MAIN_DIRECTORY_PATH}:/root/mango + - ${CONFIG_DIRECTORY_PATH}:/root/.config/mango diff --git a/env.example b/env.example new file mode 100644 index 0000000..36797f8 --- /dev/null +++ b/env.example @@ -0,0 +1,10 @@ +# Port that exposes the HTTP frontend +PORT=9000 + +# Path to the mango main directory +# This directory holds the database and the library files +MAIN_DIRECTORY_PATH= + +# Path to the mango config directory +# This directory holds the mango configuration path +CONFIG_DIRECTORY_PATH=