From bf97bd72f18989a8dda51835c399db939b177996 Mon Sep 17 00:00:00 2001 From: Cedric Verstraeten Date: Wed, 28 Jun 2023 08:41:51 +0200 Subject: [PATCH] add osusergo --- Dockerfile | 2 +- machinery/src/database/main.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 168de294..c242b5e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,7 +32,7 @@ RUN cat /go/src/github.com/kerberos-io/agent/machinery/version RUN cd /go/src/github.com/kerberos-io/agent/machinery && \ go mod download && \ - go build -tags timetzdata,netgo --ldflags '-s -w -extldflags "-static -latomic"' main.go && \ + go build -tags timetzdata,netgo,osusergo --ldflags '-s -w -extldflags "-static -latomic"' main.go && \ mkdir -p /agent && \ mv main /agent && \ mv version /agent && \ diff --git a/machinery/src/database/main.go b/machinery/src/database/main.go index 63be08ab..23b68d5a 100644 --- a/machinery/src/database/main.go +++ b/machinery/src/database/main.go @@ -28,10 +28,10 @@ func New() *mongo.Client { password := os.Getenv("MONGODB_PASSWORD") authentication := "SCRAM-SHA-256" - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - defer cancel() - _init_ctx.Do(func() { + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + _instance = new(DB) mongodbURI := fmt.Sprintf("mongodb://%s:%s@%s", username, password, host) if replicaset != "" {