Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker files to spin up hackfoldr in local machine. #64

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,29 @@ 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:

```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
```

## 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
```
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 5 additions & 5 deletions views/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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';
};
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down