Skip to content

Commit e23d928

Browse files
committed
TUN-8118: Disable FIPS module to build with go-boring without CGO_ENABLED
1 parent 159fcb4 commit e23d928

File tree

8 files changed

+23
-13
lines changed

8 files changed

+23
-13
lines changed

.teamcity/install-cloudflare-go.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
git clone -q https://github.com/cloudflare/go
2+
cd go/src
3+
# https://github.com/cloudflare/go/tree/34129e47042e214121b6bbff0ded4712debed18e is version go1.21.5-devel-cf
4+
git checkout -q 34129e47042e214121b6bbff0ded4712debed18e
5+
./make.bash

.teamcity/mac/install-cloudflare-go.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ rm -rf go
33
rm -rf gocache
44
export GOCACHE=/tmp/gocache
55

6-
git clone -q https://github.com/cloudflare/go
7-
cd go/src
8-
# https://github.com/cloudflare/go/tree/34129e47042e214121b6bbff0ded4712debed18e is version go1.21.5-devel-cf
9-
git checkout -q 34129e47042e214121b6bbff0ded4712debed18e
10-
./make.bash
6+
../install-cloudflare-go.sh
117

128
export PATH="/tmp/go/bin:$PATH"
139
go version

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@ ENV GO111MODULE=on \
66
CGO_ENABLED=0 \
77
TARGET_GOOS=${TARGET_GOOS} \
88
TARGET_GOARCH=${TARGET_GOARCH}
9-
9+
1010
WORKDIR /go/src/github.com/cloudflare/cloudflared/
1111

1212
# copy our sources into the builder image
1313
COPY . .
1414

15+
RUN .teamcity/install-cloudflare-go.sh
16+
1517
# compile cloudflared
16-
RUN make cloudflared
18+
RUN PATH="/go/src/github.com/cloudflare/cloudflared/go/bin:$PATH" make cloudflared
1719

1820
# use a distroless base image with glibc
1921
FROM gcr.io/distroless/base-debian11:nonroot

Dockerfile.amd64

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ WORKDIR /go/src/github.com/cloudflare/cloudflared/
88
# copy our sources into the builder image
99
COPY . .
1010

11+
RUN .teamcity/install-cloudflare-go.sh
12+
13+
RUN PATH="/go/src/github.com/cloudflare/cloudflared/go/bin:$PATH" go env
14+
1115
# compile cloudflared
12-
RUN GOOS=linux GOARCH=amd64 make cloudflared
16+
RUN GOOS=linux GOARCH=amd64 PATH="/go/src/github.com/cloudflare/cloudflared/go/bin:$PATH" make cloudflared
1317

1418
# use a distroless base image with glibc
1519
FROM gcr.io/distroless/base-debian11:nonroot

Dockerfile.arm64

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ WORKDIR /go/src/github.com/cloudflare/cloudflared/
88
# copy our sources into the builder image
99
COPY . .
1010

11+
RUN .teamcity/install-cloudflare-go.sh
12+
1113
# compile cloudflared
12-
RUN GOOS=linux GOARCH=arm64 make cloudflared
14+
RUN GOOS=linux GOARCH=arm64 PATH="/go/src/github.com/cloudflare/cloudflared/go/bin:$PATH" make cloudflared
1315

1416
# use a distroless base image with glibc
1517
FROM gcr.io/distroless/base-debian11:nonroot-arm64

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Downloads are available as standalone binaries, a Docker image, and Debian, RPM,
3131
* Binaries, Debian, and RPM packages for Linux [can be found here](https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation#linux)
3232
* A Docker image of `cloudflared` is [available on DockerHub](https://hub.docker.com/r/cloudflare/cloudflared)
3333
* You can install on Windows machines with the [steps here](https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation#windows)
34-
* Build from source with the [instructions here](https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation#build-from-source)
34+
* To build from source, first you need to download the go toolchain by running `./.teamcity/install-cloudflare-go.sh` and follow the output. Then you can run `make cloudflared`
3535

3636
User documentation for Cloudflare Tunnel can be found at https://developers.cloudflare.com/cloudflare-one/connections/connect-apps
3737

build-packages.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
VERSION=$(git describe --tags --always --match "[0-9][0-9][0-9][0-9].*.*")
22
echo $VERSION
33

4-
# Avoid depending on C code since we don't need it.
5-
export CGO_ENABLED=0
4+
# Disable FIPS module in go-boring
5+
export GOEXPERIMENT=noboringcrypto
66

77
# This controls the directory the built artifacts go into
88
export ARTIFACT_DIR=built_artifacts/

dev.Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ENV GO111MODULE=on \
44
WORKDIR /go/src/github.com/cloudflare/cloudflared/
55
RUN apt-get update
66
COPY . .
7+
RUN .teamcity/install-cloudflare-go.sh
78
# compile cloudflared
8-
RUN make cloudflared
9+
RUN PATH="/go/src/github.com/cloudflare/cloudflared/go/bin:$PATH" make cloudflared
910
RUN cp /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/

0 commit comments

Comments
 (0)