start production docker configuration

This commit is contained in:
Cassie Tarakajian 2018-05-17 18:43:06 -07:00
parent 41f793b130
commit c10ae61316
6 changed files with 41 additions and 6 deletions

View file

@ -53,21 +53,21 @@ Note that this takes up a significant amount of space on your machine. Make sure
* Mac: https://www.docker.com/docker-mac
* Windows: https://www.docker.com/docker-windows
2. Clone this repository and cd into it
3. `$ docker-compose build`
4. `$ docker-compose run --rm server npm run fetch-examples`
3. `$ docker-compose -f docker-compose-development.yml build`
4. `$ docker-compose -f docker-compose-development.yml run --rm server npm run fetch-examples`
Now, anytime you wish to start the server with its dependencies, you can run:
5. `$ docker-compose up`
5. `$ docker-compose -f docker-compose-development.yml 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`
7. `$ docker-compose -f docker-compose-development.yml 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`
8. `$ docker-compose -f docker-compose-development.yml run server --rm bash -l`
## Production Installation
1. Clone this repository and `cd` into it

View file

@ -0,0 +1,28 @@
version: '2'
services:
mongo:
image: mongo:3.4.7
server:
build:
context: .
dockerfile: Dockerfile-development
command: npm 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
- MAILGUN_KEY=override_in_dotenv
volumes:
- .:/opt/node/app
- /opt/node/app/node_modules
ports:
- '8000:8000'
depends_on:
- mongo

View file

@ -2,8 +2,12 @@ version: '2'
services:
mongo:
image: mongo:3.4.7
nginx:
build: ./nginx
server:
build: .
build:
context: .
dockerfile: Dockerfile-development
command: npm start
environment:
- API_URL=/api

3
nginx/Dockerfile Normal file
View file

@ -0,0 +1,3 @@
FROM nginx:1.13.12
COPY nginx.conf /etc/nginx/nginx.conf