fix(tools): use docker for development
This commit is contained in:
committed by
mrugesh mohapatra
parent
f1360f1fa7
commit
11cc25b638
@ -6,7 +6,11 @@ const {
|
|||||||
localeChallengesRootDir
|
localeChallengesRootDir
|
||||||
} = require('./utils/buildChallenges');
|
} = require('./utils/buildChallenges');
|
||||||
|
|
||||||
const { NODE_ENV: env, LOCALE: locale = 'english' } = process.env;
|
const {
|
||||||
|
NODE_ENV: env,
|
||||||
|
LOCALE: locale = 'english',
|
||||||
|
API_PROXY: proxyUrl = 'http://localhost:3000'
|
||||||
|
} = process.env;
|
||||||
|
|
||||||
const selectedGuideDir = `../${
|
const selectedGuideDir = `../${
|
||||||
env === 'production' ? 'guide' : 'mock-guide'
|
env === 'production' ? 'guide' : 'mock-guide'
|
||||||
@ -21,7 +25,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
proxy: {
|
proxy: {
|
||||||
prefix: '/internal',
|
prefix: '/internal',
|
||||||
url: 'http://localhost:3000'
|
url: proxyUrl
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
'gatsby-plugin-react-helmet',
|
'gatsby-plugin-react-helmet',
|
||||||
|
@ -1,16 +1,24 @@
|
|||||||
# Docker Compose file for FreeCodeCamp
|
# Docker Compose file for FreeCodeCamp
|
||||||
#
|
#
|
||||||
|
# if using Docker Toolbox, replace `localhost` to output form `docker-machine ip`
|
||||||
|
#
|
||||||
# Bootstrap with:
|
# Bootstrap with:
|
||||||
# docker-compose run --rm freecodecamp npm install
|
# docker-compose run --rm freecodecamp bash
|
||||||
# docker-compose run --rm freecodecamp npm run only-once
|
# npm install --unsafe-perm
|
||||||
|
# npm run seed
|
||||||
|
# exit
|
||||||
|
#
|
||||||
|
# if during install you see errors like `ETXTBSY: text file is busy, rename`
|
||||||
|
# then before install downgrade npm with command:
|
||||||
|
# npm install -g npm@5.7.1
|
||||||
#
|
#
|
||||||
# Run with:
|
# Run with:
|
||||||
# docker-compose up
|
# docker-compose up
|
||||||
#
|
#
|
||||||
version: "3"
|
version: '3'
|
||||||
services:
|
services:
|
||||||
freecodecamp:
|
freecodecamp:
|
||||||
image: node:8.10
|
image: node:lts
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
- mailhog
|
- mailhog
|
||||||
@ -18,20 +26,54 @@ services:
|
|||||||
- MAILHOG_HOST=mailhog
|
- MAILHOG_HOST=mailhog
|
||||||
- MONGOHQ_URL=mongodb://db:27017/freecodecamp
|
- MONGOHQ_URL=mongodb://db:27017/freecodecamp
|
||||||
volumes:
|
volumes:
|
||||||
- ./api-server:/app
|
- .:/app
|
||||||
working_dir: /app
|
working_dir: /app
|
||||||
|
client:
|
||||||
|
image: node:lts
|
||||||
|
environment:
|
||||||
|
- API_PROXY=http://api-server:3000
|
||||||
|
- GATSBY_WEBPACK_PUBLICPATH=http://localhost:8000/
|
||||||
|
- HOME_LOCATION=http://localhost:8000
|
||||||
|
- API_LOCATION=http://localhost:3000
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
working_dir: /app/client
|
||||||
command:
|
command:
|
||||||
- npm
|
- npm
|
||||||
- run
|
- run
|
||||||
- develop
|
- develop
|
||||||
|
- --
|
||||||
|
- -H
|
||||||
|
- '0.0.0.0'
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- '8000:8000'
|
||||||
|
- '9228:9228'
|
||||||
|
api-server:
|
||||||
|
image: node:lts
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
- mailhog
|
||||||
|
environment:
|
||||||
|
- MAILHOG_HOST=mailhog
|
||||||
|
- MONGOHQ_URL=mongodb://db:27017/freecodecamp
|
||||||
|
- COOKIE_DOMAIN=localhost
|
||||||
|
- HOME_LOCATION=http://localhost:8000
|
||||||
|
- API_LOCATION=http://localhost:3000
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
working_dir: /app/api-server
|
||||||
|
command:
|
||||||
|
- node
|
||||||
|
- development-entry.js
|
||||||
|
ports:
|
||||||
|
- '3000:3000'
|
||||||
|
- '9229:9229'
|
||||||
db:
|
db:
|
||||||
image: mongo:3.6
|
image: mongo:3.6
|
||||||
ports:
|
ports:
|
||||||
- "27017:27017"
|
- '27017:27017'
|
||||||
mailhog:
|
mailhog:
|
||||||
image: mailhog/mailhog
|
image: mailhog/mailhog
|
||||||
ports:
|
ports:
|
||||||
- "1025:1025"
|
- '1025:1025'
|
||||||
- "8025:8025"
|
- '8025:8025'
|
||||||
|
Reference in New Issue
Block a user