From 8a022d5983c9f982ba647574712741b5c838fb49 Mon Sep 17 00:00:00 2001 From: mgrimace <55518507+mgrimace@users.noreply.github.com> Date: Wed, 3 Apr 2024 17:59:16 -0400 Subject: [PATCH] Clarify docker instructions, add basic compose.yaml support This should help folks get started with docker and hopefully make it easier for testing --- .gitignore | 3 ++- README.md | 23 ++++++++++++++++++++--- compose.yaml | 8 ++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 compose.yaml diff --git a/.gitignore b/.gitignore index 7ff9e8e..11e18d1 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ package-lock.json accounts.json notes accounts.dev.json -accounts.main.json \ No newline at end of file +accounts.main.json +.DS_Store diff --git a/README.md b/README.md index ff59048..d1d012f 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,26 @@ Under development, however mainly for personal use! ## Docker (Experimental) ## 1. Download the source code -2. Make changes to your `accounts.json` and/or `config.json` -3. Run `docker build -t microsoft-rewards-script-docker .` -- Docker container has to be recreated for any changes regarding the `config.json` and/or `accounts.json`! +2. Make changes to your `accounts.json` +3. Make sure to change `"headless": false` to `"headless": true` in your `config.json` +4. Note, the container has to be recreated for any changes regarding the `config.json` and/or `accounts.json`! +### Option 1: build and run with docker run + +1. Run `docker build -t microsoft-rewards-script-docker .` to build the container +2. Run the container with `docker run --name netsky -d microsoft-rewards-script-docker` or, omit the detached flag `-d` to view the script output in your terminal. +3. Optionally, change the name of the container by changing `--name netsky` to your preferred container name +4. The container will exit after completing the script, run it again using `docker start netsky` +5. If you are running the container `-d` detached, you can view logs with `docker logs netsky` + +### Option 2: use docker compose + +1. A basic docker compose.yaml has been provided, which can be run with `docker compose up -d` or, omit the detached flag `-d` to view the script output in your terminal. + +2. The container will exit after completing the script, run it again using `docker start netsky` + +3. If you are running the container `-d` detached, you can view logs with `docker logs netsky` + + ## Config ## | Setting | Description | Default | diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..b0d46a0 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,8 @@ +services: + microsoft-rewards-script: + build: . + container_name: netsky + environment: + - NODE_ENV=production + volumes: + - .:/usr/src/microsoft-rewards-script