From f1c179b862f5dfacce2f209eb9e394a1c265b738 Mon Sep 17 00:00:00 2001 From: MrOrz Date: Fri, 20 Aug 2021 03:10:17 +0800 Subject: [PATCH 1/4] Add docker files so that anyone with docker can spin up hackfoldr --- Dockerfile | 13 +++++++++++++ README.md | 16 ++++++++++++++++ docker-compose.yml | 18 ++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e3c6878 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +# Dockerfile for development on local machine. +# + +FROM starefossen/ruby-node:2-6 + +WORKDIR /srv + +RUN gem install compass --no-document && \ + gem install tilt --version "1.4.1" --no-document + +ADD package.json ./ +RUN npm i +CMD ["npm", "start"] diff --git a/README.md b/README.md index 5d7fe88..3c9569f 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,19 @@ Please go to this [cleaner new repo](https://github.com/hackfoldr/hackfoldr-2.0- ## Why? We wiped-out all accidentally commited project specific files in the new repo, and decided to keep this repo for those projects. + +## Development + +To run hackfoldr on local machine, please install `docker` & `docker-compose` first, then run: + +``` +$ docker-compose up +``` + +This will spin up http://localhost:3000 using the latest code in the current directory. + +If you update package.json, you will need to rebuild the base image using: + +``` +$ docker-compose up --build +``` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..5132e21 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +version: '2' + +volumes: + # node_modules in hackfoldr service goes to this named volume + # so that local machine's node_modules are not messed up + # https://stackoverflow.com/a/38601156 + node_modules: + +services: + hackfoldr: + build: + context: . + volumes: + - .:/srv + # node_modules will use named volume instead of the one under current directory + - node_modules:/srv/node_modules + ports: + - 3000:3000 From d3086509d45da00511c324049b3feca6d9bbf2ee Mon Sep 17 00:00:00 2001 From: MrOrz Date: Fri, 20 Aug 2021 13:44:12 +0800 Subject: [PATCH 2/4] Update readme on build info --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3c9569f..8db0da8 100644 --- a/README.md +++ b/README.md @@ -9,14 +9,18 @@ We wiped-out all accidentally commited project specific files in the new repo, a To run hackfoldr on local machine, please install `docker` & `docker-compose` first, then run: -``` -$ docker-compose up +```bash +docker-compose up ``` This will spin up http://localhost:3000 using the latest code in the current directory. If you update package.json, you will need to rebuild the base image using: +```bash +docker-compose up --build ``` -$ docker-compose up --build -``` + +## Build + +Build process is part of the dev process above, thus all the files for production build will be in `_public` already. From b509d57cb7825fe8dca3c94d3e8d40e21aa2e481 Mon Sep 17 00:00:00 2001 From: MrOrz Date: Fri, 20 Aug 2021 13:47:45 +0800 Subject: [PATCH 3/4] Update ethercalc domain Include commit in cdf7f5f3cab308dac001c0f97ea9d97fe3cb7394 and 9f9c91a41b99c26d6ac3de5a1b43b1f4f9642e93 --- views/index.jade | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/views/index.jade b/views/index.jade index ab9fe2b..f286268 100644 --- a/views/index.jade +++ b/views/index.jade @@ -142,7 +142,7 @@ block script // let user sort #toc menu by drag and drop, a very user friendly feature suggest by @ipa. using jquery ui sortable. (also, ethercalc only) var sort_ethercalc = function(sort_initial_row, sort_target_row){ $.ajax({ - url: "https://ethercalc.org/_/"+ethercalc_name, + url: "https://ethercalc.net/_/"+ethercalc_name, contentType: 'text/plain', data: 'moveinsert A'+sort_initial_row+':F'+sort_initial_row+' A'+sort_target_row, type: 'POST', @@ -372,7 +372,7 @@ block script // set iframe src? if(current_iframe_url == "edit"){ if(csv_api_source_type=="ethercalc"){ - iframe_src = 'https://ethercalc.org/'+csv_api_source_id; + iframe_src = 'https://ethercalc.net/'+csv_api_source_id; }else{ iframe_src = 'https://docs.google.com/spreadsheets/d/'+csv_api_source_id+'/edit'; }; @@ -730,8 +730,8 @@ block script // prepare to post to ethercalc var post_ethercalc = function(post_title, post_url){ $.ajax({ - url: "https://ethercalc.org/_/"+ethercalc_name, - //url: "https://ethercalc.org/_/"+ethercalc_name+"?row="+new_pad_row_index.toString(), + url: "https://ethercalc.net/_/"+ethercalc_name, + //url: "https://ethercalc.net/_/"+ethercalc_name+"?row="+new_pad_row_index.toString(), type: 'POST', contentType: 'text/csv', processData: false, @@ -860,7 +860,7 @@ block script // show sheet if(!hide_sheet){ if(csv_api_source_type=="ethercalc"){ - $("#topbar .edit.table").attr("href",'https://ethercalc.org/'+csv_api_source_id); + $("#topbar .edit.table").attr("href",'https://ethercalc.net/'+csv_api_source_id); // make foldr items sortable if(sort_sheet){ $("#toc .sortable").sortable(sort_action); From ce9aef843c3603575cf26378e7506fb302834c8a Mon Sep 17 00:00:00 2001 From: MrOrz Date: Fri, 20 Aug 2021 14:12:55 +0800 Subject: [PATCH 4/4] Add build-only script --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 8db0da8..01ecc8d 100644 --- a/README.md +++ b/README.md @@ -24,3 +24,9 @@ docker-compose up --build ## Build Build process is part of the dev process above, thus all the files for production build will be in `_public` already. + +To just build `_public` without running a server, use the following command: + +```bash +docker-compose run --rm hackfoldr npm run build +```