From 91472e1259997fb94b920fc7d5a053ed9a35d66f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Fri, 7 Aug 2026 07:57:53 +0400 Subject: [PATCH] =?UTF-8?q?go-container:=20ENV=20=D0=B2=20Dockerfile,=20?= =?UTF-8?q?=D0=B1=D0=B5=D0=B7=20=D1=85=D0=B0=D1=80=D0=B4=D0=BA=D0=BE=D0=B4?= =?UTF-8?q?=D0=B0=20=D0=B2=20Go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 8 ++++++++ server/main.go | 11 +++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5db9992..5255549 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,5 +12,13 @@ RUN go mod init tf-registry && go mod tidy && CGO_ENABLED=0 go build -o registry FROM alpine:3.21 RUN apk --no-cache add ca-certificates COPY --from=builder /app/registry /registry + +# ── Non-secret defaults (change here → rebuild → push → redeploy) ───────── +ENV S3_ENDPOINT=s3.msk-1.ngcloud.ru \ + S3_BUCKET=terraform-registry \ + S3_PREFIX=registry.kube5s.ru \ + PORT=5000 +# ── Secrets go in UI jsonEnv: S3_ACCESS_KEY, S3_SECRET_KEY ───────────────── + EXPOSE 5000 CMD ["/registry"] diff --git a/server/main.go b/server/main.go index 8071c79..a8146c8 100644 --- a/server/main.go +++ b/server/main.go @@ -71,16 +71,11 @@ type GPGPublicKey struct { func main() { // 1. Init S3 Connection if hostname == "" { - hostname = "localhost:8080" + hostname = "localhost:5000" } - // ── TEMPORARY HARDCODE ────────────────────────────────────────────────── - // S3 data is stored under old hostname prefix from the previous Go deploy. - // TODO: REMOVE after devops adds jsonEnv editing to containerk8s "modify". - // Then read from ENV: s3Prefix = os.Getenv("S3_PREFIX") - // And set in UI jsonEnv: "S3_PREFIX": "registry.kube5s.ru" - // ───────────────────────────────────────────────────────────────────────── + // S3_PREFIX default comes from Dockerfile ENV; override in jsonEnv if needed. if s3Prefix == "" { - s3Prefix = "registry.kube5s.ru" + s3Prefix = hostname } endpoint := os.Getenv("S3_ENDPOINT")