Skip to content
This repository has been archived by the owner on May 28, 2018. It is now read-only.

Commit

Permalink
split dev and build environnements
Browse files Browse the repository at this point in the history
  • Loading branch information
nbrohee committed Sep 26, 2016
1 parent 9f757a6 commit 42cfb7e
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 14 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,23 @@ Le site: https://etudiant-entrepreneur.beta.gouv.fr/
### Node+Docker

```
docker-compose up api
npm install
npm start
```
Seul le backend est "contenerisé", le frontend est accessible via browsersync
### Build Env with Nginx front

```
npm install
npm run build
```
Frontend et backend sont dans des conteneurs.
Le frontend est build avec npm avant d'être ajouté à un conteneur Nginx.
### 100% Docker

```
docker-compose up
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up --build
```

Dans `client/webpack.config.dev.js` modifier:

```
Expand Down
2 changes: 1 addition & 1 deletion client/Dockerfile → client/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM node:6
EXPOSE 3000
EXPOSE 80
WORKDIR /app
ADD ./package.json /app/
WORKDIR /app
Expand Down
2 changes: 1 addition & 1 deletion client/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import autoprefixer from 'autoprefixer'
const GLOBALS = {
'process.env.NODE_ENV': JSON.stringify('production'),
__DEV__: false,
API_URI: JSON.stringify('https://etudiant-entrepreneur.herokuapp.com/api')
API_URI: JSON.stringify('http://localhost:3004/api')
}

export default {
Expand Down
9 changes: 9 additions & 0 deletions docker-compose.build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: '2'

services:
front:
build:
context: ./client/
dockerfile: Dockerfile.build
ports:
- 3000:80
12 changes: 12 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '2'

services:
front:
build:
context: ./client/
dockerfile: Dockerfile.dev
volumes:
- ./client:/app
ports:
- 3000:3000
- 3001:3001
7 changes: 0 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ services:
- SENDGRID_API_KEY=${SENDGRID_API_KEY}
depends_on:
- mongo
front:
build: ./client
volumes:
- ./client:/app
ports:
- 3000:3000
- 3001:3001

networks:
front:
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
"install:back": "cd server && npm install",
"install:front": "cd client && npm install",
"start": "npm-run-all --sequential start:back start:front",
"start:back": "docker-compose up -d",
"start:back": "docker-compose up -d api",
"start:front": "cd client && npm run start",
"test": "npm-run-all --sequential test:back test:front test:docker",
"test:docker": "./tools/dockerTest.sh",
"test:back": "cd server && npm test",
"test:front": "cd client && npm test",
"lint": "npm-run-all --sequential lint:back lint:front",
"lint:back": "cd server && npm run lint",
"lint:front": "cd client && npm run lint"
"lint:front": "cd client && npm run lint",
"prebuild" : "cd client && npm run build",
"build": "docker-compose -f docker-compose.yml -f docker-compose.build.yml up --build"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 42cfb7e

Please sign in to comment.