Changed Build beha.

This commit is contained in:
Phil 2022-01-06 18:53:02 +01:00
parent 659db1a727
commit bd8d884f09
2 changed files with 5 additions and 22 deletions

View file

@ -6,8 +6,11 @@ WORKDIR /go/src/git.ucode.space/goshorly
COPY . . COPY . .
RUN go get -d -v ./... 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 FROM scratch as production
WORKDIR /goshorly WORKDIR /goshorly

View file

@ -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