version: '3'

services:
  drone-server:
    image: drone/drone:2.5

    ports:
      - "<%= @upstream_port %>:80"
    volumes:
      - drone-server-data:/data
    restart: always
    environment:
      - DRONE_USER_CREATE=username:greg,admin:true
      - DRONE_GITEA_SERVER=<%= @gitea_server %>
      - DRONE_GITEA_CLIENT_ID=<%= @client_id %>
      - DRONE_GITEA_CLIENT_SECRET=<%= @client_secret %>
      - DRONE_SERVER_HOST=<%= @domain %>
      - DRONE_SERVER_PROTO=https # required for the Redirect URI to be built correctly
      - DRONE_RPC_SECRET=<%= @rpc_secret %>

  drone-runner:
    image: drone/drone-runner-docker:1.8

    command: agent
    restart: always
    depends_on:
      - drone-server
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DRONE_RPC_HOST=drone-server:80
      - DRONE_RPC_SECRET=<%= @rpc_secret %>
      - DRONE_RUNNER_MAX_PROCS=<%= @max_procs %>

volumes:
  drone-server-data:
