version: "3.3"
services:
  app:
    build: .
    command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
    hostname: app
    volumes:
      - .:/app
    ports:
      - "3000:3000"
    networks:
      - internal
    environment:
      TEAMSNAP_CLIENT_ID: "${TEAMSNAP_CLIENT_ID}"
      TEAMSNAP_CLIENT_SECRET: "${TEAMSNAP_CLIENT_SECRET}"
  webserver:
    image: nginx:latest
    ports:
      - 80:80
      - 443:443
    networks:
      - internal
    volumes:
      - ./nginx/conf/:/etc/nginx/conf.d/:ro
      - ./certbot/www:/var/www/certbot/:ro
      - ./certbot/conf/:/etc/nginx/ssl/:ro
  certbot:
    image: certbot/certbot:latest
    volumes:
      - ./certbot/www/:/var/www/certbot/:rw
      - ./certbot/conf/:/etc/letsencrypt/:rw

networks:
  internal:
    driver: bridge
