Skip to content

Commit

Permalink
Improve docs to use go cli instead of docker
Browse files Browse the repository at this point in the history
  • Loading branch information
jungrafael committed Jul 6, 2022
1 parent 1f45195 commit 0c4e24f
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,18 @@ HEALTHCHECK CMD healthcheck

## Building

To build it for alpine, you can use the go-alpine image, for example (alternatively, for ARM64, you can use `docker run --rm -it arm64v8/golang:1.17-alpine`):
To build it for alpine, you can use the go-alpine image, for example (alternatively, for ARM64, you can use `docker run --rm -it arm64v8/golang:1.17-alpine`) or directly from the command line with go installed:

```bash
docker run --rm -it --platform linux/amd64 amd64/golang:1.17-alpine
go build healthcheck.go
```

Then copy the go file to the running container:

```bash
docker cp healthcheck.go CONTAINER_NAME:/go/healthcheck.go
```
The binary will be created inside the current directory with name `healthcheck`

Build it from the container
Or alternatively for other operational systems or architectures, use respectively the envs `GOOS` and `GOARCH` (for better portability, make sure to use static linking with `CGO_ENABLED=0`):

```bash
go build healthcheck.go
```
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o healthcheck_linux_amd64 healthcheck.go

And copy back the binary to the host

```bash
docker cp CONTAINER_NAME:/go/healthcheck healthcheck
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o healthcheck_linux_arm64 healthcheck.go
```

0 comments on commit 0c4e24f

Please sign in to comment.