From 983588b6c90a3f9da4b9d1d4cd7e4e5577d4468f Mon Sep 17 00:00:00 2001 From: CPunch Date: Tue, 20 Jun 2023 18:33:29 -0500 Subject: [PATCH] dockerfile: switch to scratch - build.sh: disables CGO and specifies linux - we really don't need the cstdlib now, and we don't need a busybox shell --- Dockerfile | 11 ++++------- build.sh | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index bc2512b..26dcbf8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,7 @@ -FROM alpine:latest - -WORKDIR /gopenfusion +FROM scratch # grab binary -COPY ./bin/server ./ -RUN chmod +x ./server +WORKDIR /gopenfusion +COPY --chmod=0755 ./bin/server ./ -ENTRYPOINT [ "/bin/sh", "-l", "-c" ] -CMD ["/gopenfusion/server"] \ No newline at end of file +ENTRYPOINT [ "/gopenfusion/server" ] \ No newline at end of file diff --git a/build.sh b/build.sh index df9cfa3..c2dbab7 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,5 @@ #!/bin/sh mkdir -p bin -go build -o ./bin/server +CGO_ENABLED=0 GOOS=linux go build -o ./bin/server echo 'Done' \ No newline at end of file