Help us shape the future of Go! Take the 2026 Go Developer Survey

mirror

package
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package mirror rewrites docker.io image references in compose YAML to point at an alternate registry (typically a GHCR mirror). Intended for CI/E2E where Docker Hub rate limits can block deploys, but the same mechanism works for local dev when SIMPLEDEPLOY_IMAGE_MIRROR_PREFIX is set.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RewriteCompose

func RewriteCompose(composeYAML []byte, prefix string) []byte

RewriteCompose returns composeYAML with every docker.io-bound image reference rewritten to prefix + normalized path. prefix must include trailing slash (e.g. "ghcr.io/vazra/"). If prefix is empty, returns the input unchanged.

Rules:

  • Images already targeting a non-default registry (ghcr.io, quay.io, any host with "." or ":" in the first path segment) are left alone.
  • Official images (no namespace) get "library/" stripped; a single segment "nginx:alpine" becomes "<prefix>nginx:alpine".
  • Digest refs (@sha256:...) and tags (:tag) are preserved verbatim.

func RewritePortsLoopback

func RewritePortsLoopback(composeYAML []byte) []byte

RewritePortsLoopback prefixes every "host:container" ports list entry with "127.0.0.1:" so the published port is reachable only from the host itself. Caddy still proxies external traffic to the same upstream (resolved as localhost:host_port), so external behavior is unchanged while the bypass-Caddy hole is closed.

Operator-explicit entries (already pinned to an IP) are left alone. Set SIMPLEDEPLOY_DISABLE_PORT_LOOPBACK=true to skip the rewrite globally.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL