# capgo-proxy: the public entry point of the self-host stack. Caddy on one domain: serves the # console and routes /api, /plugin, /files, /auth/v1 and /functions/v1 to the Workers. # # docker run -d -p 80:80 -p 443:443 -v capgo-proxy-data:/data \ # -e DOMAIN=capgo.example.com -e ACME_EMAIL=admin@example.com \ # -e CAPGO_API_UPSTREAM=api:8787 -e CAPGO_PLUGIN_UPSTREAM=plugin:8787 -e CAPGO_FILES_UPSTREAM=files:8787 \ # ghcr.io/cap-go/capgo-proxy # # Every env var and route: selfhost/capgo-proxy/README.md. # Build from the repository root: docker build -f selfhost/capgo-proxy/Dockerfile . # Built and published by .github/workflows/selfhost_images.yml. # Same Bun version as scripts/setup-bun.sh. FROM oven/bun:1.3.11-alpine AS console WORKDIR /app COPY . . RUN bun install --frozen-lockfile --ignore-scripts # Build-time defaults point at a reserved .invalid domain, never at capgo.app: the real values come # from /config.js at runtime. ENV BRANCH=selfhost \ API_DOMAIN=capgo.invalid/api \ BASE_DOMAIN=capgo.invalid \ CAPTCHA_KEY= \ PLUGIN_REGION_TARGETS='[{"name":"selfhost","envName":"selfhost","url":"https://capgo.invalid/ok"}]' RUN bun run build \ && rm -f dist/_headers dist/_redirects FROM caddy:2.11.9-alpine LABEL org.opencontainers.image.source="https://github.com/Cap-go/capgo.app" \ org.opencontainers.image.description="Capgo self-host proxy: console and Workers on one domain" \ org.opencontainers.image.licenses="AGPL-3.0-only" COPY --from=console /app/dist/ /srv/console/ COPY selfhost/capgo-proxy/config.js /srv/console/config.js COPY selfhost/capgo-proxy/Caddyfile /etc/caddy/Caddyfile COPY --chmod=755 selfhost/capgo-proxy/entrypoint.sh /usr/local/bin/capgo-proxy # Non-root. Docker lets containers bind ports below 1024 (ip_unprivileged_port_start=0), except # with --network host. A new volume on /data takes this ownership. RUN addgroup -S caddy && adduser -S -G caddy -h /data caddy && chown -R caddy:caddy /data /config USER caddy # Certificates and ACME account live in /data: mount a volume so restarts keep them. EXPOSE 80 443 443/udp ENTRYPOINT ["capgo-proxy"] CMD ["run"]