# syntax=docker/dockerfile:1
FROM supabase/postgres:15.8.1.085

# Install WAL-G v3.0.5 — kept in lockstep with carbon/backup/Dockerfile.
# Earlier v3.0.3 URL 404'd in 2026-04-26 (alpine variant retired upstream),
# and curl without --fail piped a 404 HTML body into tar which surfaced
# as "not in gzip format" instead of an honest HTTP error. --fail makes
# curl exit non-zero on 4xx/5xx so the failure is unmistakable.
#
# Single RUN with `apt-get purge -y --auto-remove curl` collapses the
# install + cleanup into one layer so the curl binary doesn't end up
# in the published image (saving ~5MB and reducing attack surface).
RUN apt-get update && apt-get install -y --no-install-recommends \
        curl \
        ca-certificates \
    && curl -fL https://github.com/wal-g/wal-g/releases/download/v3.0.5/wal-g-pg-ubuntu-22.04-amd64.tar.gz | tar -xz \
    && mv wal-g-pg-ubuntu-22.04-amd64 /usr/local/bin/wal-g \
    && chmod +x /usr/local/bin/wal-g \
    && apt-get purge -y --auto-remove curl \
    && rm -rf /var/lib/apt/lists/*

# The supabase image already has many configurations.
# We will enable archiving via environment variables or a custom config snippet if needed.
