version: "3.2" services: app: tty: true stdin_open: true build: context: . dockerfile: Dockerfile links: - db environment: - APP_DBHOST=db volumes: - .:/opt/webapps/app ports: - "3000:3000" command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails server -p 3000 -b '0.0.0.0'" web: image: nginx volumes: - ./docker/nginx.template:/etc/nginx/conf.d/nginx.template ports: - "80:80" links: - app environment: APP: 'app' command: /bin/bash -c "envsubst '$$APP' < /etc/nginx/conf.d/nginx.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'" db: image: postgres:9.4