services:
  onetimesecret-redis:
    image: redis:7-alpine
    command: redis-server --requirepass ${REDIS_PASSWORD}
    restart: unless-stopped
    healthcheck:
      test:
        - CMD
        - redis-cli
        - ping
      interval: 30s
      timeout: 10s
      retries: 3

  onetimesecret:
    image: 'onetimesecret/onetimesecret:latest'
    restart: unless-stopped
    environment:
      # To see all available environment variables, visit:
      # https://github.com/onetimesecret/onetimesecret/blob/develop/etc/config.example.yaml
      - AUTH_AUTOVERIFY=true
      - AUTH_SIGNUP=true

      # Accounts created with this email address will have admin access
      - COLONEL=${COLONEL}

      # If you change your domain, make sure to update the HOST environment variable.
      - HOST=${HOST}

      - RACK_ENV=production
      - REDIS_URL=redis://:${REDIS_PASSWORD}@onetimesecret-redis:6379/0
      - SECRET=${SECRET}
      - SSL=true
    depends_on:
      - onetimesecret-redis
    healthcheck:
      test:
        - CMD
        - ruby
        - '-rnet/http'
        - '-e'
        - "exit(Net::HTTP.get_response(URI('http://localhost:3000')).is_a?(Net::HTTPSuccess) ? 0 : 1)"
      interval: 30s
      timeout: 10s
      retries: 3
