-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5359 from onflow/tarak/new-cd-images-v0.33
Backport PR 5254
- Loading branch information
Showing
10 changed files
with
429 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
FROM golang:1.20-bullseye AS build-setup | ||
|
||
RUN apt-get update | ||
RUN apt-get -y install zip | ||
RUN apt-get -y install zip apt-utils gcc-aarch64-linux-gnu | ||
|
||
## (2) Setup crypto dependencies | ||
FROM build-setup AS build-env | ||
|
@@ -27,7 +27,7 @@ COPY . . | |
RUN git config --global [email protected]:.insteadOf https://github.com/ | ||
RUN mkdir ~/.ssh | ||
|
||
# Add GitHub known host | ||
# Add GitHub known host to avoid prompts or failures on key check | ||
RUN ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts | ||
|
||
#################################### | ||
|
@@ -36,19 +36,22 @@ FROM build-env as build-production | |
WORKDIR /app | ||
|
||
ARG GOARCH=amd64 | ||
|
||
# TAGS can be overriden to modify the go build tags (e.g. build without netgo) | ||
ARG TAGS="netgo" | ||
# CGO_FLAG can be overwritten | ||
ARG CGO_FLAG | ||
# CC flag can be overwritten to specify a C compiler | ||
ARG CC="" | ||
# CGO_FLAG uses ADX instructions by default, flag can be overwritten to build without ADX | ||
ARG CGO_FLAG="" | ||
|
||
# Keep Go's build cache between builds. | ||
# https://github.com/golang/go/issues/27719#issuecomment-514747274 | ||
RUN --mount=type=cache,sharing=locked,target=/go/pkg/mod \ | ||
--mount=type=cache,target=/root/.cache/go-build \ | ||
--mount=type=secret,id=cadence_deploy_key \ | ||
# We evaluate the SSH agent to safely pass in a key for cloning dependencies | ||
# We explicitly use ";" rather than && as we want to safely pass if it is unavailable | ||
eval `ssh-agent -s` && printf "%s\n" "$(cat /run/secrets/cadence_deploy_key)" | ssh-add - ; \ | ||
CGO_ENABLED=1 GOOS=linux CGO_FLAGS="${CGO_FLAG}" go build --tags "${TAGS}" -ldflags "-extldflags -static \ | ||
CGO_ENABLED=1 GOOS=linux GOARCH=${GOARCH} CC="${CC}" CGO_FLAGS="${CGO_FLAG}" go build --tags "${TAGS}" -ldflags "-extldflags -static \ | ||
-X 'github.com/onflow/flow-go/cmd/build.commit=${COMMIT}' -X 'github.com/onflow/flow-go/cmd/build.semver=${VERSION}'" \ | ||
-o ./app ${TARGET} | ||
|
||
|
@@ -66,13 +69,16 @@ ENTRYPOINT ["/bin/app"] | |
FROM build-env as build-debug | ||
WORKDIR /app | ||
ARG GOARCH=amd64 | ||
|
||
ARG CC="" | ||
ARG CGO_FLAG="" | ||
RUN --mount=type=ssh \ | ||
--mount=type=cache,sharing=locked,target=/go/pkg/mod \ | ||
--mount=type=cache,target=/root/.cache/go-build \ | ||
--mount=type=secret,id=cadence_deploy_key \ | ||
# We evaluate the SSH agent to safely pass in a key for cloning dependencies | ||
# We explicitly use ";" rather than && as we want to safely pass if it is unavailable | ||
eval `ssh-agent -s` && printf "%s\n" "$(cat /run/secrets/cadence_deploy_key)" | ssh-add - ; \ | ||
CGO_ENABLED=1 GOOS=linux CGO_FLAGS="${CGO_FLAG}" go build --tags "netgo" -ldflags "-extldflags -static \ | ||
CGO_ENABLED=1 GOOS=linux GOARCH=${GOARCH} CC="${CC}" CGO_FLAGS="${CGO_FLAG}" go build --tags "netgo" -ldflags "-extldflags -static \ | ||
-X 'github.com/onflow/flow-go/cmd/build.commit=${COMMIT}' -X 'github.com/onflow/flow-go/cmd/build.semver=${VERSION}'" \ | ||
-gcflags="all=-N -l" -o ./app ${TARGET} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters