Full-stack javascript development with

Why use docker for development?

Works on my machine

Works on your machine

Works on my machine

Works on my machine tomorrow

Works on my machine

Works in production

+

Write a Dockerfile

Write a compose file

Run the app

FROM node:6

ENV HOME=/code
ENV NPM_CONFIG_LOGLEVEL warn

COPY package.json npm-shrinkwrap.json $HOME/

WORKDIR $HOME

RUN npm install

COPY . $HOME/

EXPOSE 8000

CMD ["npm", "start"]
version: '2'

services:
  api:
    build: .
    command: npm run dev
    ports:
      - '8000:8000'
    volumes:
      - .:/code
      - /code/node_modules

  test:
    build: .
    command: npm run test -- --watch
    volumes:
      - .:/code
      - /code/node_modules
$ docker-compose up

2

1

3

version: '2'

services:
  api:
    image: 'rthor/scheduler-api:latest'
    ports:
      - "8000:8000"
    links:
      - db
  db:
    image: 'postgres:latest'
    environment:
      - POSTGRES_USER=root
      - POSTGRES_PASSWORD=pw
    volumes:
      - /db
    expose:
      - 5432
$ brew install dnsmasq

Configuring a .dev domain

# /etc/resolver/dev
nameserver 127.0.0.1
# /usr/local/etc/dnsmasq.conf
address=/dev/127.0.0.1
// webpack.config.js

entry: {
  app: [
    'webpack/hot/dev-server',
    'webpack-dev-server/client?http://tala.dev',
  ]
}

devServer: {
  host: '0.0.0.0',
},

slides.com/davidblurton

github.com/talaislensku

Made with Slides.com