From 97838dfccd475bc67a241e69c31c98770bc185b3 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Wed, 8 Nov 2023 08:31:34 -0800 Subject: [PATCH] attempting to build static binary. Make sure we "test" binary in final static-debian11 container by running help as part of build. --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4d5abba5..71b63597 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,7 +33,7 @@ RUN --mount=type=cache,target=/tmp/lock,sharing=locked \ && go generate ./... \ && go vet ./... \ && go test -timeout=20m ./... \ - && go build -o /go/bin/fasten ./backend/cmd/fasten/ + && go build -ldflags "-extldflags=-static" -tags "static" -o /go/bin/fasten ./backend/cmd/fasten/ # create folder structure RUN mkdir -p /opt/fasten/db \ @@ -52,7 +52,7 @@ COPY --from=frontend-build /usr/src/fastenhealth/dist /opt/fasten/web COPY --from=backend-build /go/bin/fasten /opt/fasten/fasten COPY LICENSE.md /opt/fasten/LICENSE.md COPY config.yaml /opt/fasten/config/config.yaml - +RUN ["/opt/fasten/fasten", "--help"] CMD ["/opt/fasten/fasten", "start", "--config", "/opt/fasten/config/config.yaml"]