Skip to content

Commit

Permalink
docker build fixes for go 1.22 - no GO111MODULE support
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Avetisyan <[email protected]>
  • Loading branch information
havetisyan committed Oct 18, 2024
1 parent dbab62d commit 398b545
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 30 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/docker-build-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@ jobs:
architecture: ${{ env.JAVA_ARCH }}
cache: 'maven'

# - name: Build with Maven
# id: build-maven
# run: mvn --batch-mode --update-snapshots package -DskipTests=true

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
Expand Down
5 changes: 2 additions & 3 deletions docker/util/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,12 @@ RUN addgroup --system --gid ${GID} athenz-utils && \
adduser --system --disabled-password --no-create-home --shell /sbin/nologin --uid ${UID} --ingroup athenz-utils athenz-utils

# fix to have rdl binary available to be used by client generators.
RUN GO111MODULE=off go get -u github.com/ardielle/ardielle-tools/... \
RUN go install github.com/ardielle/ardielle-tools/...@latest \
&& mkdir -p /root/go/src/github.com/AthenZ/athenz/clients/go/zms/bin && cp /root/go/bin/rdl /root/go/src/github.com/AthenZ/athenz/clients/go/zms/bin \
&& mkdir -p /root/go/src/github.com/AthenZ/athenz/clients/go/zts/bin && cp /root/go/bin/rdl /root/go/src/github.com/AthenZ/athenz/clients/go/zts/bin \
&& mkdir -p /root/go/src/github.com/AthenZ/athenz/clients/go/msd/bin && cp /root/go/bin/rdl /root/go/src/github.com/AthenZ/athenz/clients/go/msd/bin

RUN GO111MODULE=on \
CGO_ENABLED=0 \
RUN CGO_ENABLED=0 \
CGO_CXXFLAGS="-g -Ofast -march=native" \
CGO_FFLAGS="-g -Ofast -march=native" \
CGO_LDFLAGS="-g -Ofast -march=native" \
Expand Down
7 changes: 0 additions & 7 deletions docker/util/athenz-mvn-base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ COPY --from=rdl-go-model /usr/bin/rdl-gen-athenz-go-model /usr/bin/rdl-gen-athen
# copy pom.xml
WORKDIR /athenz
COPY pom.xml .
# cat pom.xml | grep "<module>.*</module>" | awk -F'[><]' '{ printf "COPY ./%s/pom.xml ./%s/pom.xml\n", $3, $3 }'
COPY ./rdl/rdl-gen-athenz-server/pom.xml ./rdl/rdl-gen-athenz-server/pom.xml
COPY ./rdl/rdl-gen-athenz-go-model/pom.xml ./rdl/rdl-gen-athenz-go-model/pom.xml
COPY ./rdl/rdl-gen-athenz-go-client/pom.xml ./rdl/rdl-gen-athenz-go-client/pom.xml
Expand Down Expand Up @@ -86,10 +85,4 @@ COPY ./assembly/zts/pom.xml ./assembly/zts/pom.xml
COPY ./assembly/ui/pom.xml ./assembly/ui/pom.xml
COPY ./assembly/utils/pom.xml ./assembly/utils/pom.xml

# RUN mvn -U -B dependency:resolve --fail-never
# RUN mvn -U -B dependency:resolve --fail-never -DexcludeGroupIds=com.yahoo.athenz

RUN mvn -U -B dependency:go-offline --fail-never -DdockerBuild=true
# RUN mvn -U -B dependency:go-offline --fail-never -DexcludeGroupIds=com.yahoo.athenz

# docker run -it --name athenz-base-mvn athenz-base-mvn sh; docker rm athenz-base-mvn
8 changes: 4 additions & 4 deletions docker/util/rdl-athenz-go-model/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@ RUN set -eux && apt-get update \

WORKDIR ${GOPATH}/src/github.com/AthenZ/athenz/rdl/rdl-gen-athenz-go-model

RUN GO111MODULE=off go get -u github.com/ardielle/ardielle-go/... \
&& GO111MODULE=off go get -u github.com/ardielle/ardielle-tools/... \
RUN go install github.com/ardielle/ardielle-tools/...@latest \
&& mv ${GOPATH}/bin/rdl /usr/bin/rdl

COPY . .

RUN go mod init github.com/AthenZ/athenz/rdl/rdl-gen-athenz-go-model \
&& go get -u github.com/ardielle/ardielle-go/...

RUN if [ $(go env GOARCH) = "amd64" ]; then \
CGO_ENABLED=1 \
CGO_CXXFLAGS="-g -Ofast -march=native" \
CGO_FFLAGS="-g -Ofast -march=native" \
CGO_LDFLAGS="-g -Ofast -march=native" \
GOOS=$(go env GOOS) \
GOARCH=$(go env GOARCH) \
GO111MODULE=off \
go build --ldflags '-s -w -linkmode "external" -extldflags "-static -fPIC -m64 -pthread -std=c++11 -lstdc++"' -a -tags "cgo netgo" -installsuffix "cgo netgo" -o "${APP_NAME}" \
&& upx -9 -o "/usr/bin/${APP_NAME}" "${APP_NAME}"; \
elif [ $(go env GOARCH) = "arm64" ]; then \
Expand All @@ -30,7 +31,6 @@ RUN if [ $(go env GOARCH) = "amd64" ]; then \
CGO_LDFLAGS="-g -Ofast -march=native" \
GOOS=$(go env GOOS) \
GOARCH=$(go env GOARCH) \
GO111MODULE=off \
go build --ldflags '-s -w -linkmode "external" -extldflags "-static -fPIC -march=armv8-a -pthread -std=c++11 -lstdc++"' -a -tags "cgo netgo" -installsuffix "cgo netgo" -o "${APP_NAME}" \
&& upx -9 -o "/usr/bin/${APP_NAME}" "${APP_NAME}"; \
fi
Expand Down
8 changes: 4 additions & 4 deletions docker/util/rdl-athenz-java-client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@ RUN set -eux && apt-get update \

WORKDIR ${GOPATH}/src/github.com/AthenZ/athenz/rdl/rdl-gen-athenz-java-client

RUN GO111MODULE=off go get -u github.com/ardielle/ardielle-go/... \
&& GO111MODULE=off go get -u github.com/ardielle/ardielle-tools/... \
RUN go install github.com/ardielle/ardielle-tools/...@latest \
&& mv ${GOPATH}/bin/rdl /usr/bin/rdl

COPY . .

RUN go mod init github.com/AthenZ/athenz/rdl/rdl-gen-athenz-java-client \
&& go get -u github.com/ardielle/ardielle-go/...

RUN if [ $(go env GOARCH) = "amd64" ]; then \
CGO_ENABLED=1 \
CGO_CXXFLAGS="-g -Ofast -march=native" \
CGO_FFLAGS="-g -Ofast -march=native" \
CGO_LDFLAGS="-g -Ofast -march=native" \
GOOS=$(go env GOOS) \
GOARCH=$(go env GOARCH) \
GO111MODULE=off \
go build --ldflags '-s -w -linkmode "external" -extldflags "-static -fPIC -m64 -pthread -std=c++11 -lstdc++"' -a -tags "cgo netgo" -installsuffix "cgo netgo" -o "${APP_NAME}" \
&& upx -9 -o "/usr/bin/${APP_NAME}" "${APP_NAME}"; \
elif [ $(go env GOARCH) = "arm64" ]; then \
Expand All @@ -30,7 +31,6 @@ RUN if [ $(go env GOARCH) = "amd64" ]; then \
CGO_LDFLAGS="-g -Ofast -march=native" \
GOOS=$(go env GOOS) \
GOARCH=$(go env GOARCH) \
GO111MODULE=off \
go build --ldflags '-s -w -linkmode "external" -extldflags "-static -fPIC -march=armv8-a -pthread -std=c++11 -lstdc++"' -a -tags "cgo netgo" -installsuffix "cgo netgo" -o "${APP_NAME}" \
&& upx -9 -o "/usr/bin/${APP_NAME}" "${APP_NAME}"; \
fi
Expand Down
8 changes: 4 additions & 4 deletions docker/util/rdl-athenz-java-model/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@ RUN set -eux && apt-get update \

WORKDIR ${GOPATH}/src/github.com/AthenZ/athenz/rdl/rdl-gen-athenz-java-model

RUN GO111MODULE=off go get -u github.com/ardielle/ardielle-go/... \
&& GO111MODULE=off go get -u github.com/ardielle/ardielle-tools/... \
RUN go install github.com/ardielle/ardielle-tools/...@latest \
&& mv ${GOPATH}/bin/rdl /usr/bin/rdl

COPY . .

RUN go mod init github.com/AthenZ/athenz/rdl/rdl-gen-athenz-java-model \
&& go get -u github.com/ardielle/ardielle-go/...

RUN if [ $(go env GOARCH) = "amd64" ]; then \
CGO_ENABLED=1 \
CGO_CXXFLAGS="-g -Ofast -march=native" \
CGO_FFLAGS="-g -Ofast -march=native" \
CGO_LDFLAGS="-g -Ofast -march=native" \
GOOS=$(go env GOOS) \
GOARCH=$(go env GOARCH) \
GO111MODULE=off \
go build --ldflags '-s -w -linkmode "external" -extldflags "-static -fPIC -m64 -pthread -std=c++11 -lstdc++"' -a -tags "cgo netgo" -installsuffix "cgo netgo" -o "${APP_NAME}" \
&& upx -9 -o "/usr/bin/${APP_NAME}" "${APP_NAME}"; \
elif [ $(go env GOARCH) = "arm64" ]; then \
Expand All @@ -30,7 +31,6 @@ RUN if [ $(go env GOARCH) = "amd64" ]; then \
CGO_LDFLAGS="-g -Ofast -march=native" \
GOOS=$(go env GOOS) \
GOARCH=$(go env GOARCH) \
GO111MODULE=off \
go build --ldflags '-s -w -linkmode "external" -extldflags "-static -fPIC -march=armv8-a -pthread -std=c++11 -lstdc++"' -a -tags "cgo netgo" -installsuffix "cgo netgo" -o "${APP_NAME}" \
&& upx -9 -o "/usr/bin/${APP_NAME}" "${APP_NAME}"; \
fi
Expand Down
8 changes: 4 additions & 4 deletions docker/util/rdl-athenz-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@ RUN set -eux && apt-get update \

WORKDIR ${GOPATH}/src/github.com/AthenZ/athenz/rdl/rdl-gen-athenz-server

RUN GO111MODULE=off go get -u github.com/ardielle/ardielle-go/... \
&& GO111MODULE=off go get -u github.com/ardielle/ardielle-tools/... \
RUN go install github.com/ardielle/ardielle-tools/...@latest \
&& mv ${GOPATH}/bin/rdl /usr/bin/rdl

COPY . .

RUN go mod init github.com/AthenZ/athenz/rdl/rdl-gen-athenz-server \
&& go get -u github.com/ardielle/ardielle-go/...

RUN if [ $(go env GOARCH) = "amd64" ]; then \
CGO_ENABLED=1 \
CGO_CXXFLAGS="-g -Ofast -march=native" \
CGO_FFLAGS="-g -Ofast -march=native" \
CGO_LDFLAGS="-g -Ofast -march=native" \
GOOS=$(go env GOOS) \
GOARCH=$(go env GOARCH) \
GO111MODULE=off \
go build --ldflags '-s -w -linkmode "external" -extldflags "-static -fPIC -m64 -pthread -std=c++11 -lstdc++"' -a -tags "cgo netgo" -installsuffix "cgo netgo" -o "${APP_NAME}" \
&& upx -9 -o "/usr/bin/${APP_NAME}" "${APP_NAME}"; \
elif [ $(go env GOARCH) = "arm64" ]; then \
Expand All @@ -30,7 +31,6 @@ RUN if [ $(go env GOARCH) = "amd64" ]; then \
CGO_LDFLAGS="-g -Ofast -march=native" \
GOOS=$(go env GOOS) \
GOARCH=$(go env GOARCH) \
GO111MODULE=off \
go build --ldflags '-s -w -linkmode "external" -extldflags "-static -fPIC -march=armv8-a -pthread -std=c++11 -lstdc++"' -a -tags "cgo netgo" -installsuffix "cgo netgo" -o "${APP_NAME}" \
&& upx -9 -o "/usr/bin/${APP_NAME}" "${APP_NAME}"; \
fi
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ require (
cloud.google.com/go/compute v1.28.0 // indirect
cloud.google.com/go/compute/metadata v0.5.0 // indirect
cloud.google.com/go/iam v1.2.0 // indirect
github.com/ardielle/ardielle-tools v1.5.4 // indirect
github.com/aws/aws-sdk-go v1.55.5 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.28 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.12 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ cloud.google.com/go/secretmanager v1.14.1/go.mod h1:L+gO+u2JA9CCyXpSR8gDH0o8EV7i
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/ardielle/ardielle-go v1.5.2 h1:TilHTpHIQJ27R1Tl/iITBzMwiUGSlVfiVhwDNGM3Zj4=
github.com/ardielle/ardielle-go v1.5.2/go.mod h1:I4hy1n795cUhaVt/ojz83SNVCYIGsAFAONtv2Dr7HUI=
github.com/ardielle/ardielle-tools v1.5.4 h1:2uL/7wZRUF4LGV7r2eTaaeyhkBoqdiqEitSXMd6k8F8=
github.com/ardielle/ardielle-tools v1.5.4/go.mod h1:oZN+JRMnqGiIhrzkRN9l26Cej9dEx4jeNG6A+AdkShk=
github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
github.com/aws/aws-sdk-go-v2 v1.30.4 h1:frhcagrVNrzmT95RJImMHgabt99vkXGslubDaDagTk8=
github.com/aws/aws-sdk-go-v2 v1.30.4/go.mod h1:CT+ZPWXbYrci8chcARI3OmI/qgd+f6WtuLOoaIA8PR0=
Expand Down Expand Up @@ -125,6 +127,8 @@ github.com/googleapis/gax-go/v2 v2.13.0 h1:yitjD5f7jQHhyDsnhKEBU52NdvvdSeGzlAnDP
github.com/googleapis/gax-go/v2 v2.13.0/go.mod h1:Z/fvTZXF8/uw7Xu5GuslPw+bplx6SS338j1Is2S+B7A=
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
github.com/jawher/mow.cli v1.0.4/go.mod h1:5hQj2V8g+qYmLUVWqu4Wuja1pI57M83EChYLVZ0sMKk=
github.com/jawher/mow.cli v1.2.0 h1:e6ViPPy+82A/NFF/cfbq3Lr6q4JHKT9tyHwTCcUQgQw=
github.com/jawher/mow.cli v1.2.0/go.mod h1:y+pcA3jBAdo/GIZx/0rFjw/K2bVEODP9rfZOfaiq8Ko=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
Expand Down

0 comments on commit 398b545

Please sign in to comment.