captainVersion: 4
services:
    $$cap_appname:
        image: tvanro/prerender-alpine:6.4.0
        restart: always
        environment:
            MEMORY_CACHE: $$cap_memory_cache
            CACHE_MAXSIZE: $$cap_cache_max_size
            CACHE_TTL: $$cap_cache_ttl
            BLACKLISTED_DOMAINS: $$cap_blacklisted_domains
        caproverExtra:
            containerHttpPort: '3000'
caproverOneClickApp:
    variables:
        - id: $$cap_memory_cache
          label: Enable memory cache?
          defaultValue: 1
          validRegex: /^[01]$/
          description: Serve cache responses in memory.

        - id: $$cap_cache_max_size
          label: Cache Max Size
          defaultValue: 10000
          validRegex: /^[0-9]*$/
          description: Max number of objects(pages) in cache.

        - id: $$cap_cache_ttl
          label: Cache time to live in (seconds)
          defaultValue: 7200
          validRegex: /^[0-9]*$/
          description: Maximum time to live in seconds of objects(pages).

        - id: $$cap_blacklisted_domains
          label: 'Optional: Blacklisted domains, separated by ",". Leave empty if none.'
          description: 'Blacklisted domains which will not be pre rendered. E.g: yahoo.com,www.google.com'

    instructions:
        start: >-
            Prerender is a node server that uses Headless Chrome to render HTML,
            screenshots, PDFs, and HAR files out of any web page. The Prerender
            server listens for an http request, takes the URL and loads it in
            Headless Chrome, waits for the page to finish loading by waiting for
            the network to be idle, and then returns your content.

            You can choose wheter to expose it as a web app, or not.

        end: >-
            Your service is available at http://$$cap_appname.$$cap_root_domain

            Check its health with:

            curl -X GET 'http://$$cap_appname.$$cap_root_domain/render?url=https://www.example.com
    displayName: 'Prerender'
    isOfficial: true
    description: Prerender uses Headless Chrome to render HTML, screenshots, PDFs, and HAR files out of any web page, in order to serve them to crawlers.
    documentation: https://hub.docker.com/r/tvanro/prerender-alpine
