fix(tools): use docker for development

This commit is contained in:
Valeriy
2019-02-07 01:36:33 +03:00
committed by mrugesh mohapatra
parent f1360f1fa7
commit 11cc25b638
2 changed files with 77 additions and 31 deletions

View File

@ -6,7 +6,11 @@ const {
localeChallengesRootDir
} = 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 = `../${
env === 'production' ? 'guide' : 'mock-guide'
@ -21,7 +25,7 @@ module.exports = {
},
proxy: {
prefix: '/internal',
url: 'http://localhost:3000'
url: proxyUrl
},
plugins: [
'gatsby-plugin-react-helmet',

View File

@ -1,37 +1,79 @@
# Docker Compose file for FreeCodeCamp
#
# if using Docker Toolbox, replace `localhost` to output form `docker-machine ip`
#
# Bootstrap with:
# docker-compose run --rm freecodecamp npm install
# docker-compose run --rm freecodecamp npm run only-once
# docker-compose run --rm freecodecamp bash
# 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:
# docker-compose up
#
version: "3"
version: '3'
services:
freecodecamp:
image: node:8.10
depends_on:
- db
- mailhog
environment:
- MAILHOG_HOST=mailhog
- MONGOHQ_URL=mongodb://db:27017/freecodecamp
volumes:
- ./api-server:/app
working_dir: /app
command:
- npm
- run
- develop
ports:
- "3000:3000"
db:
image: mongo:3.6
ports:
- "27017:27017"
mailhog:
image: mailhog/mailhog
ports:
- "1025:1025"
- "8025:8025"
freecodecamp:
image: node:lts
depends_on:
- db
- mailhog
environment:
- MAILHOG_HOST=mailhog
- MONGOHQ_URL=mongodb://db:27017/freecodecamp
volumes:
- .:/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:
- npm
- run
- develop
- --
- -H
- '0.0.0.0'
ports:
- '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:
image: mongo:3.6
ports:
- '27017:27017'
mailhog:
image: mailhog/mailhog
ports:
- '1025:1025'
- '8025:8025'