From 56f6312e0ff991a7fda3aa009669668af880dc8f Mon Sep 17 00:00:00 2001 From: Martin Ruskov Date: Sun, 21 May 2023 22:34:53 +0200 Subject: [PATCH 1/5] Added container and compose that allows working with the entire source directory as a mount point --- Dockerfile | 10 ++++++++++ README.md | 12 +++++++++++- docker-compose.yml | 15 +++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..b602597f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM node:14-alpine + +EXPOSE 3000 + +# this counts on the rawgraphs repository directory being mounted in /app, +# as done by docker-compose.yml + +WORKDIR /app + +ENTRYPOINT yarn install && yarn start --host 0.0.0.0 diff --git a/README.md b/README.md index 445f2527..507c08ad 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ If you want to run your instance of RAWGraphs locally on your machine, be sure y If you want to run your instance of RAWGraphs locally on your machine, be sure you have the following requirements installed. - [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) (it could be used through the interface of [GitHub Desktop](https://desktop.github.com/)) -- [Node.js](https://nodejs.org/en/) +- [Node.js](https://nodejs.org/en/) (version 14) - [Yarn](https://yarnpkg.com/getting-started/install) ### Instructions (macOS) @@ -63,6 +63,16 @@ You can also build your own version and upload it on your server by running the yarn build ``` +### Instructions (docker on any platform) + +You might have a newer version of node installed. If so, you could benefit from running the `RAWGraphs-app` in an isolated container. To do this you will need to have docker installed. Then open the terminal in the root folder of the repository and type: + +```shell +docker-compose up +``` + +This will install and start yarn. If you want to build your own production version, you would need to modify your docker configuration accordingly. + ## Contributing Want to contribute to RAWGraphs's development? You are more than welcome! Start by forking the repository (the "Fork" button at the top-right corner of this page) and follow the instructions above to clone it and install dependencies. Then you can use Github's issues and pull requests to discuss and share your work. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..332f908b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +version: '3.9' + +services: + rawgraphs: + container_name: rawgraphs + build: + context: . + dockerfile: Dockerfile + volumes: + - .:/app + # tty: true + stdin_open: true + ports: + - 3000:3000 + From 4369e5eb95379bd28e4c3473cb86c615a6c22d3d Mon Sep 17 00:00:00 2001 From: Martin Ruskov Date: Sun, 21 May 2023 22:37:00 +0200 Subject: [PATCH 2/5] Cleanup --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 332f908b..83f82f77 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,6 @@ services: dockerfile: Dockerfile volumes: - .:/app - # tty: true stdin_open: true ports: - 3000:3000 From 445e58c561d8dee67e18eefdfa4e4e15789e5807 Mon Sep 17 00:00:00 2001 From: Martin Ruskov Date: Wed, 26 Jul 2023 10:38:16 +0200 Subject: [PATCH 3/5] Merged Dockerfile into docker-compose.yml (untested) --- docker-compose.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 83f82f77..c151b57b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,12 +3,14 @@ version: '3.9' services: rawgraphs: container_name: rawgraphs - build: - context: . - dockerfile: Dockerfile + image: node:14-alpine + expose: + - 3000 volumes: - .:/app stdin_open: true ports: - 3000:3000 + working_dir: /app + entrypoint: ["yarn", "install", "&&", "yarn", "start", "--host", "0.0.0.0"] From 5a257c8492aeeaf00df01d97ef8e8f0a0f265df1 Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 26 Jul 2023 10:51:40 +0200 Subject: [PATCH 4/5] Fixed, tested and cleaned up compose without Dockerfile --- Dockerfile | 10 ---------- docker-compose.yml | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index b602597f..00000000 --- a/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM node:14-alpine - -EXPOSE 3000 - -# this counts on the rawgraphs repository directory being mounted in /app, -# as done by docker-compose.yml - -WORKDIR /app - -ENTRYPOINT yarn install && yarn start --host 0.0.0.0 diff --git a/docker-compose.yml b/docker-compose.yml index c151b57b..7b05cdfb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,5 +12,5 @@ services: ports: - 3000:3000 working_dir: /app - entrypoint: ["yarn", "install", "&&", "yarn", "start", "--host", "0.0.0.0"] + entrypoint: ["/bin/sh", "-c" ,"yarn install && yarn start --host 0.0.0.0"] From 31d920f1cc3d7f17f9a81509ab17b22fcfb89c7c Mon Sep 17 00:00:00 2001 From: Martin Ruskov Date: Mon, 30 Oct 2023 16:28:49 +0100 Subject: [PATCH 5/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 507c08ad..70670237 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ You might have a newer version of node installed. If so, you could benefit from docker-compose up ``` -This will install and start yarn. If you want to build your own production version, you would need to modify your docker configuration accordingly. +This will install and start yarn. To access the app, open http://localhost:3000 as you would do otherwise. If you want to build your own production version, you would need to modify your docker configuration accordingly. ## Contributing