Write a Dockerfile
Write a compose file
Run the app
FROM node:6.4 ENV NPM_CONFIG_LOGLEVEL warn WORKDIR /code/ COPY npm-shrinkwrap.json . RUN npm install COPY . . EXPOSE 8000 CMD ["npm", "start"]
version: '2' services: api: build: . command: npm run dev ports: - '8000:8000' volumes: - .:/code - api-deps:/code/node_modules volumes: api-deps:
$ docker-compose up
$ docker-compose run api npm install cors
$ npm install cors
services: ... test: build: . command: npm run test -- --watch volumes: - .:/code - api-deps:/code/node_modules
services: api: ... links: - db db: image: 'postgres:latest' environment: - POSTGRES_USER=root - POSTGRES_PASSWORD=pw volumes: - /db expose: - 5432
$ brew install dnsmasq
# /etc/resolver/dev nameserver 127.0.0.1
# /usr/local/etc/dnsmasq.conf address=/dev/127.0.0.1
services: api: ... environment: - VIRTUAL_HOST=api.tala.dev proxy: image: 'dockercloud/haproxy:latest' // jwilder/nginx-proxy links: - api ports: - '80:80' - '443:443' - '1936:1936' volumes: - '/var/run/docker.sock:/var/run/docker.sock'
// 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
By rakeen