FROM debian:bookworm-slim WORKDIR /app RUN apt-get update && \ apt-get install -y wget ca-certificates curl jq gettext-base && \ rm -rf /var/lib/apt/lists/* # Download and extract latest sub2api binary for Linux amd64 RUN LATEST_URL=$(curl -s https://api.github.com/repos/Wei-Shaw/sub2api/releases/latest | \ jq -r '.assets[] | select(.name | test("linux.*amd64")) | .browser_download_url' | head -1) && \ echo "Downloading: $LATEST_URL" && \ wget -q "$LATEST_URL" -O sub2api.tar.gz && \ tar -xzf sub2api.tar.gz && \ rm -f sub2api.tar.gz && \ chmod +x /app/sub2api # Copy config template COPY config.yaml /app/config.template.yaml # Startup script: substitute env vars then launch RUN printf '#!/bin/bash\nenvsubst < /app/config.template.yaml > /app/config.yaml\nexec /app/sub2api\n' > /app/start.sh && \ chmod +x /app/start.sh EXPOSE 7860 CMD ["/app/start.sh"]