BartlomiejSkwira
10/3/2016 - 12:42 PM

use docker-unison on Mac

use docker-unison on Mac

#add unison to docker-compose.yml - see second file 
docker build unison

#install unison
brew install unison

#install unison-fsmonitor in order to use -repeat option
pip install MacFSEvents

# unox is unison-fsmonitor script for Mac
$ curl -o /usr/local/bin/unison-fsmonitor -L https://raw.githubusercontent.com/hnsl/unox/master/unox.py
$ chmod +x /usr/local/bin/unison-fsmonitor

#launch a volume container exposing a volume with Unison.
$ docker-compose start unison


#sync a local folder to $UNISON_DIR (default value: /data) in the container
#launch this 1 dir above project dir
unison project_dir socket://localhost:5000/ -repeat watch -ignore 'Path {.git,tmp,log}' -auto -batch -prefer project_dir

#launch a container connected with the volume 
docker-compose up
sidekiq: &rails_env
  build: .
  volumes_from:
    - bundle
    - unison


unison:
  image: onnimonni/unison
  environment:
    - UNISON_DIR=/selecthub
  ports:
    - "5000:5000"
  volumes:
    - /selecthub