diff --git a/Dockerfile b/Dockerfile index 540ab40..696083a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,8 +6,11 @@ WORKDIR /go/src/git.ucode.space/goshorly COPY . . RUN go get -d -v ./... -RUN chmod +x build-ci.sh -RUN /go/src/git.ucode.space/goshorly/build-ci.sh + +RUN export I_PACKAGE="git.ucode.space/Phil/goshorly/utils" && \ + export I_GitCommitShort=$(git rev-parse --short HEAD) && \ + export I_GitBranch=$(git rev-parse --abbrev-ref HEAD) && \ + go build -a -installsuffix cgo -ldflags "-X $I_PACKAGE.GitCommitShort=$I_GitCommitShort -X $I_PACKAGE.GitBranch=$I_GitBranch" -o app . FROM scratch as production WORKDIR /goshorly diff --git a/build-ci.sh b/build-ci.sh deleted file mode 100644 index d72d989..0000000 --- a/build-ci.sh +++ /dev/null @@ -1,20 +0,0 @@ -export I_PACKAGE="git.ucode.space/Phil/goshorly/utils" -export I_GitCommitShort=$(git rev-parse --short HEAD) -export I_GitBranch=$(git rev-parse --abbrev-ref HEAD) - -go mod download - -case $1 in - "linux") - CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags "-X $I_PACKAGE.GitCommitShort=$I_GitCommitShort -X $I_PACKAGE.GitBranch=$I_GitBranch" -o app-linux-amd64 . - ;; - "windows") - CGO_ENABLED=0 GOOS=windows go build -a -installsuffix cgo -ldflags "-X $I_PACKAGE.GitCommitShort=$I_GitCommitShort -X $I_PACKAGE.GitBranch=$I_GitBranch" -o app-windows-amd64 . - ;; - "darwin") - CGO_ENABLED=0 GOOS=darwin go build -a -installsuffix cgo -ldflags "-X $I_PACKAGE.GitCommitShort=$I_GitCommitShort -X $I_PACKAGE.GitBranch=$I_GitBranch" -o app-darwin-amd64 . - ;; - *) - CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags "-X $I_PACKAGE.GitCommitShort=$I_GitCommitShort -X $I_PACKAGE.GitBranch=$I_GitBranch" -o app . - ;; -esac