Add a Dockerfile, Docker Compose configuration, and instructions on how to run a full development environment using Docker. Also include a yarn.lock file for installing exact node module versions with yarn instead of npm.
This commit is contained in:
parent
cfd6bf75b2
commit
e085773155
5 changed files with 7734 additions and 6 deletions
11
.eslintrc
11
.eslintrc
|
@ -34,14 +34,15 @@
|
||||||
"html": false
|
"html": false
|
||||||
}],
|
}],
|
||||||
"newline-per-chained-call": 0,
|
"newline-per-chained-call": 0,
|
||||||
"react/prefer-stateless-function": [2,
|
"react/prefer-stateless-function": [2,
|
||||||
{ "ignorePureComponents": true
|
{ "ignorePureComponents": true
|
||||||
}],
|
}],
|
||||||
"class-methods-use-this": 0
|
"class-methods-use-this": 0,
|
||||||
|
"no-return-assign": [2, "except-parens"]
|
||||||
},
|
},
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"react", "jsx-a11y", "import"
|
"react", "jsx-a11y", "import"
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"import/parser": "babel-eslint",
|
"import/parser": "babel-eslint",
|
||||||
"import/resolve": {
|
"import/resolve": {
|
||||||
|
@ -55,4 +56,4 @@
|
||||||
"__DISABLE_SSR__": true,
|
"__DISABLE_SSR__": true,
|
||||||
"__DEVTOOLS__": true
|
"__DEVTOOLS__": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
18
Dockerfile
Normal file
18
Dockerfile
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
FROM node:6.11.2
|
||||||
|
|
||||||
|
ENV APP_HOME=/opt/node/app \
|
||||||
|
TERM=xterm
|
||||||
|
|
||||||
|
# Copy in the project files and set as working directory
|
||||||
|
ADD . $APP_HOME
|
||||||
|
WORKDIR $APP_HOME
|
||||||
|
|
||||||
|
# Install node modules
|
||||||
|
RUN git submodule init && \
|
||||||
|
yarn install
|
||||||
|
|
||||||
|
# For development, mark the directory as a mount override point
|
||||||
|
VOLUME $APP_HOME
|
||||||
|
|
||||||
|
# Expose default server port
|
||||||
|
EXPOSE 8000
|
29
README.md
29
README.md
|
@ -1,6 +1,6 @@
|
||||||
# p5.js Web Editor
|
# p5.js Web Editor
|
||||||
|
|
||||||
This project is currently in development! It will be announced when there is a (public) beta release.
|
This project is currently in development! It will be announced when there is a (public) beta release.
|
||||||
|
|
||||||
## Development Installation
|
## Development Installation
|
||||||
|
|
||||||
|
@ -37,6 +37,33 @@ Please refer to [this gist](https://gist.github.com/andrewn/953ffd5cb17ac2634dc9
|
||||||
|
|
||||||
The automatic redirection to HTTPS is turned off by default in development. If you need to test this behavior, put `FORCE_TO_HTTPS=true` in your `.env` file.
|
The automatic redirection to HTTPS is turned off by default in development. If you need to test this behavior, put `FORCE_TO_HTTPS=true` in your `.env` file.
|
||||||
|
|
||||||
|
## Development Installation (using Docker)
|
||||||
|
|
||||||
|
Using Docker, you can have a complete, consistent development environment
|
||||||
|
without having to manually install dependencies such as Node, Mongo, etc. It
|
||||||
|
also helps isolate these dependencies and their data from other projects that
|
||||||
|
you may have on the same computer that use different/conflicting versions, etc.
|
||||||
|
|
||||||
|
1. Install Docker for your operating system
|
||||||
|
* Mac: https://www.docker.com/docker-mac
|
||||||
|
* Windows: https://www.docker.com/docker-windows
|
||||||
|
2. Clone this repostory and cd into it
|
||||||
|
3. `$ docker-compose build`
|
||||||
|
4. `$ docker-compose run --rm server yarn run fetch-examples`
|
||||||
|
|
||||||
|
Now, anytime you wish to start the server with its dependencies, you can run:
|
||||||
|
|
||||||
|
5. `$ docker-compose up`
|
||||||
|
6. Navigate to [http://localhost:8000](http://localhost:8000) in your browser
|
||||||
|
|
||||||
|
To open a terminal/shell in the running Docker server (i.e. after `docker-compose up` has been run):
|
||||||
|
|
||||||
|
7. `$ docker-compose exec server bash -l`
|
||||||
|
|
||||||
|
If you don't have the full server environment running, you can launch a one-off container instance (and have it automatically deleted after you're done using it):
|
||||||
|
|
||||||
|
8. `$ docker-compose run server --rm bash -l`
|
||||||
|
|
||||||
## Production Installation
|
## Production Installation
|
||||||
1. Clone this repostory and `cd` into it
|
1. Clone this repostory and `cd` into it
|
||||||
2. `$ git submodule init`
|
2. `$ git submodule init`
|
||||||
|
|
25
docker-compose.yml
Normal file
25
docker-compose.yml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
version: '2'
|
||||||
|
services:
|
||||||
|
mongo:
|
||||||
|
image: mongo:3.4.7
|
||||||
|
server:
|
||||||
|
build: .
|
||||||
|
command: yarn start
|
||||||
|
environment:
|
||||||
|
- API_URL=/api
|
||||||
|
- MONGO_URL=mongodb://mongo:27017/p5js-web-editor
|
||||||
|
- PORT=8000
|
||||||
|
- SESSION_SECRET=override_in_dotenv
|
||||||
|
- AWS_ACCESS_KEY=override_in_dotenv
|
||||||
|
- AWS_SECRET_KEY=override_in_dotenv
|
||||||
|
- AWS_REGION=override_in_dotenv
|
||||||
|
- S3_BUCKET=override_in_dotenv
|
||||||
|
- GITHUB_ID=override_in_dotenv
|
||||||
|
- GITHUB_SECRET=override_in_dotenv
|
||||||
|
volumes:
|
||||||
|
- .:/opt/node/app
|
||||||
|
- /opt/node/app/node_modules
|
||||||
|
ports:
|
||||||
|
- '8000:8000'
|
||||||
|
depends_on:
|
||||||
|
- mongo
|
Loading…
Reference in a new issue