Build static Go binary
parent
58734a9d7a
commit
30ddfeab38
|
@ -19,6 +19,8 @@ steps:
|
||||||
|
|
||||||
- label: ":docker: Image Builds"
|
- label: ":docker: Image Builds"
|
||||||
command: ".buildkite/steps/buildimages.sh | buildkite-agent pipeline upload"
|
command: ".buildkite/steps/buildimages.sh | buildkite-agent pipeline upload"
|
||||||
|
agents:
|
||||||
|
build: "true"
|
||||||
branches: "master v*"
|
branches: "master v*"
|
||||||
depends_on:
|
depends_on:
|
||||||
- "build"
|
- "build"
|
||||||
|
|
|
@ -27,10 +27,10 @@ RUN echo "Write tag ${BUILD_TAG} and commit ${BUILD_COMMIT} in binary." && \
|
||||||
sed -i "s/__BUILD_TIME__/${BUILD_TIME}/" cmd/authelia/constants.go
|
sed -i "s/__BUILD_TIME__/${BUILD_TIME}/" cmd/authelia/constants.go
|
||||||
|
|
||||||
# CGO_ENABLED=1 is mandatory for building go-sqlite3
|
# CGO_ENABLED=1 is mandatory for building go-sqlite3
|
||||||
RUN cd cmd/authelia && GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -tags netgo -ldflags '-w' -o authelia && cd ../../
|
RUN cd cmd/authelia && GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -tags netgo -ldflags '-w -linkmode external -extldflags -static' -o authelia && cd ../../
|
||||||
|
|
||||||
# CGO_ENABLED=1 is mandatory for building go-sqlite3
|
# CGO_ENABLED=1 is mandatory for building go-sqlite3
|
||||||
RUN cd cmd/authelia-scripts && GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o authelia-scripts
|
RUN cd cmd/authelia-scripts && GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o authelia-scripts -ldflags '-w -linkmode external -extldflags -static'
|
||||||
|
|
||||||
|
|
||||||
# ========================================
|
# ========================================
|
||||||
|
|
|
@ -28,10 +28,10 @@ RUN echo "Write tag ${BUILD_TAG} and commit ${BUILD_COMMIT} in binary." && \
|
||||||
sed -i "s/__BUILD_TIME__/${BUILD_TIME}/" cmd/authelia/constants.go
|
sed -i "s/__BUILD_TIME__/${BUILD_TIME}/" cmd/authelia/constants.go
|
||||||
|
|
||||||
# CGO_ENABLED=1 is mandatory for building go-sqlite3
|
# CGO_ENABLED=1 is mandatory for building go-sqlite3
|
||||||
RUN cd cmd/authelia && GOOS=linux GOARCH=arm CGO_ENABLED=1 go build -tags netgo -ldflags '-w' -o authelia && cd ../../
|
RUN cd cmd/authelia && GOOS=linux GOARCH=arm CGO_ENABLED=1 go build -tags netgo -ldflags '-w -linkmode external -extldflags -static' -o authelia && cd ../../
|
||||||
|
|
||||||
# CGO_ENABLED=1 is mandatory for building go-sqlite3
|
# CGO_ENABLED=1 is mandatory for building go-sqlite3
|
||||||
RUN cd cmd/authelia-scripts && GOOS=linux GOARCH=arm CGO_ENABLED=1 go build -o authelia-scripts
|
RUN cd cmd/authelia-scripts && GOOS=linux GOARCH=arm CGO_ENABLED=1 go build -o authelia-scripts -ldflags '-w -linkmode external -extldflags -static'
|
||||||
|
|
||||||
|
|
||||||
# ========================================
|
# ========================================
|
||||||
|
|
|
@ -28,10 +28,10 @@ RUN echo "Write tag ${BUILD_TAG} and commit ${BUILD_COMMIT} in binary." && \
|
||||||
sed -i "s/__BUILD_TIME__/${BUILD_TIME}/" cmd/authelia/constants.go
|
sed -i "s/__BUILD_TIME__/${BUILD_TIME}/" cmd/authelia/constants.go
|
||||||
|
|
||||||
# CGO_ENABLED=1 is mandatory for building go-sqlite3
|
# CGO_ENABLED=1 is mandatory for building go-sqlite3
|
||||||
RUN cd cmd/authelia && GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go build -tags netgo -ldflags '-w' -o authelia && cd ../../
|
RUN cd cmd/authelia && GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go build -tags netgo -ldflags '-w -linkmode external -extldflags -static' -o authelia && cd ../../
|
||||||
|
|
||||||
# CGO_ENABLED=1 is mandatory for building go-sqlite3
|
# CGO_ENABLED=1 is mandatory for building go-sqlite3
|
||||||
RUN cd cmd/authelia-scripts && GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go build -o authelia-scripts
|
RUN cd cmd/authelia-scripts && GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go build -o authelia-scripts -ldflags '-w -linkmode external -extldflags -static'
|
||||||
|
|
||||||
|
|
||||||
# ========================================
|
# ========================================
|
||||||
|
|
Loading…
Reference in New Issue