Skip to content

Commit

Permalink
refactor: Update build-docker.sh to use CGO_ENABLED=0 for cross-compi…
Browse files Browse the repository at this point in the history
…ling
  • Loading branch information
renuka-fernando committed Jun 16, 2024
1 parent 8138b63 commit 6f08b02
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,12 @@ curl https://localhost:8443/foo \


## 2. Build From Source
run `./build-docker.sh`

Execute the following command to build the Docker image.

```sh
./build-docker.sh
```

## 3. Deploy in Choreo

Expand Down
4 changes: 2 additions & 2 deletions build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ IMAGE_NAME=renukafernando/request-info:latest

# install docker buildx plugin

env GOOS=linux GOARCH=amd64 go build -o request-info-amd64 .
env GOOS=linux GOARCH=arm64 go build -o request-info-arm64 .
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o request-info-amd64 .
env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o request-info-arm64 .

#docker buildx build --push --platform linux/arm64/v8,linux/amd64 -t "$IMAGE_NAME" .
docker build --build-arg TARGETARCH=arm64 -t "$IMAGE_NAME" .
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func main() {
flag.StringVar(&key, "key", "server.key", "Key file for HTTPS server")
flag.StringVar(&clientCA, "ca", "ca.crt", "CA certificate file for client verification")
flag.IntVar(&delayMs, "delayMs", 0, "Time to wait (ms) before responding to request")
flag.IntVar(&statusCode, "statusCode", 200, "HTTP status code to respond")
flag.IntVar(&statusCode, "status", 200, "HTTP status code to respond")
flag.Parse()

serviceName, _ = os.LookupEnv("NAME")
Expand Down

0 comments on commit 6f08b02

Please sign in to comment.