From ebe63f0ee3a9a95b3383866c1ddaeb3553acb836 Mon Sep 17 00:00:00 2001 From: samoorai Date: Tue, 24 Oct 2023 04:25:57 +0200 Subject: [PATCH] Enhance README: Add Docker Compose Example and Improve Environment Variable Formatting (#31) * Added a docker compose example with port * Modified the order of examples * Moved container name * Typos and added env variables table --------- Co-authored-by: samurai --- README.md | 45 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 91aa2dc..96fe53f 100644 --- a/README.md +++ b/README.md @@ -2,21 +2,48 @@ A Dockerfile for beancount-fava -## Environment Variable - -- `BEANCOUNT_FILE`: path to your beancount file. Default to empty string. ## Usage Example +You can get started creating a container from this image, you can either use docker-compose or the docker cli. + +Assuming you have `example.bean` in the current directory: + +### Docker Cli + ```bash -# assume you have example.bean in the current directory -docker run -v $PWD:/bean -e BEANCOUNT_FILE=/bean/example.bean yegle/fava +docker run -d \ + --name=syncthing \ + -v $PWD:/bean \ + -e BEANCOUNT_FILE=/bean/example.bean \ + -p 5000:5000 \ + --restart unless-stopped \ + yegle/fava ``` -NOTE: The command above does not expose the Fava HTTP server port outside of Docker's internal network. -This allows you [to use your own reverse proxy](https://github.com/beancount/fava/tree/main/contrib/docker#advanced). -If you do want to expose the service without using a reverse proxy for local testing, you must add `-p 5000:5000` -to access Fava on http://localhost:5000. +### Docker Compose + +```yml +--- +version: "3.0" +services: + fava: + container_name: fava + image: yegle/fava + ports: + - 5000:5000 + environment: + - BEANCOUNT_FILE=/bean/example.beancount + volumes: + - ${PWD}/:/bean + restart: unless-stopped +``` + +## Environment Variable + +| Parameter | Value | +| :----: | --- | +| `BEANCOUNT_FILE` | path to your beancount file. Default to empty string. | ## Note on auto build