Skip to content

Commit bed2286

Browse files
authored
Merge pull request #338 from gythialy/hotfix/read-me
docs: update README
2 parents cf1af1b + e672372 commit bed2286

File tree

1 file changed

+44
-48
lines changed

1 file changed

+44
-48
lines changed

README.md

Lines changed: 44 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -4,70 +4,66 @@ Docker container to do cross compilation (Linux, windows, macOS, ARM, ARM64) of
44

55
## Docker images
66

7-
- Find it on GitHub packages
7+
### Pre-built Images
88

9-
- golang-cross
10-
```
11-
docker pull ghcr.io/gythialy/golang-cross:latest
12-
```
13-
- golang-cross-builder
14-
```
15-
docker pull ghcr.io/gythialy/golang-cross-builder:v1.22.0-0-bullseye
16-
```
17-
```
18-
docker pull ghcr.io/gythialy/golang-cross-builder:v1.17.1
19-
```
9+
- golang-cross
10+
```
11+
docker pull ghcr.io/gythialy/golang-cross:latest
12+
```
13+
- golang-cross-builder
14+
```
15+
docker pull ghcr.io/gythialy/golang-cross-builder:v1.22.0-0-bullseye
16+
docker pull ghcr.io/gythialy/golang-cross-builder:v1.17.1
17+
```
18+
19+
### Build your own
20+
- Build base image (optional)
21+
```
22+
docker build -f Dockerfile_builder -t ghcr.io/gythialy/golang-cross-builder:v1.17.1 .
23+
# if running docker on M1 (arm64) macOS:
24+
docker build --platform linux/amd64 -f Dockerfile.builder -t ghcr.io/gythialy/golang-cross-builder:v1.18 .
25+
```
26+
> Note: [Pack the SDK](https://github.com/tpoechtrager/osxcross#packaging-the-sdk) first or use [GitHub Action](https://github.com/gythialy/golang-cross/actions/workflows/osx-sdk.yaml)
2027
21-
- Build your own images
22-
- Build base image (optional)
23-
```
24-
docker build -f Dockerfile_builder -t ghcr.io/gythialy/golang-cross-builder:v1.17.1 .
25-
```
26-
if running docker on M1 (arm64) macbook:
27-
```
28-
docker build --platform linux/amd64 -f Dockerfile.builder -t ghcr.io/gythialy/golang-cross-builder:v1.18 .
29-
```
30-
> Please follow the guide to [pack the SDK](https://github.com/tpoechtrager/osxcross#packaging-the-sdk) first or build by [GitHub Action](https://github.com/gythialy/golang-cross/actions/workflows/osx-sdk.yaml)
31-
- Build golang-cross image
32-
```
33-
docker build --build-arg GO_VERSION=1.22.0 \
34-
--build-arg OS_CODENAME=bullseye \
35-
--build-arg GOLANG_DIST_SHA=542e936b19542e62679766194364f45141fde55169db2d8d01046555ca9eb4b8 \
36-
--build-arg GORELEASER_VERSION=1.24.0 \
37-
--build-arg GORELEASER_SHA=4b7d2f1e59ead8047fcef795d66236ff6f8cfe7302c1ff8fb31bd360a3c6f32e \
38-
-f Dockerfile \
39-
-t ghcr.io/gythialy/golang-cross:latest .
40-
```
41-
> The default arguments can be overridden with `--build-arg`
28+
- Build golang-cross image
29+
```
30+
docker build --build-arg GO_VERSION=1.22.0 \
31+
--build-arg OS_CODENAME=bullseye \
32+
--build-arg GOLANG_DIST_SHA=542e936b19542e62679766194364f45141fde55169db2d8d01046555ca9eb4b8 \
33+
--build-arg GORELEASER_VERSION=1.24.0 \
34+
--build-arg GORELEASER_SHA=4b7d2f1e59ead8047fcef795d66236ff6f8cfe7302c1ff8fb31bd360a3c6f32e \
35+
-f Dockerfile \
36+
-t ghcr.io/gythialy/golang-cross:latest .
37+
```
38+
> Override default arguments with `--build-arg`
4239
43-
## How to use
40+
## Usage
4441

4542
- Prepare [GoReleaser](https://goreleaser.com/intro/) configuration
4643

47-
- Generate environment variable `PRIVATE_KEY` from the GPG private key (optional), if enable the [signing](https://goreleaser.com/customization/sign/) feature
44+
- Set up GPG signing (optional), if enable the [signing](https://goreleaser.com/customization/sign/) feature
4845

4946
```bash
5047
export PRIVATE_KEY=$(cat ~/private_key.gpg | base64)
5148
```
5249

53-
- Run docker container to build the binaries
54-
50+
- Build the binaries:
5551
```bash
56-
export GO_BUILDER_VERSION=v1.17.1
57-
docker run --rm --privileged \
58-
-e PRIVATE_KEY=$(PRIVATE_KEY) \
59-
-v $(CURDIR):/golang-cross-example \
60-
-v /var/run/docker.sock:/var/run/docker.sock \
61-
-v $(GOPATH)/src:/go/src \
62-
-w /golang-cross-example \
63-
ghcr.io/gythialy/golang-cross:$(GO_BUILDER_VERSION) --snapshot --rm-dist
52+
export GO_BUILDER_VERSION=v1.17.1;
53+
docker run --rm --privileged \
54+
-e PRIVATE_KEY=$(PRIVATE_KEY) \
55+
-v $(CURDIR):/golang-cross-example \
56+
-v /var/run/docker.sock:/var/run/docker.sock \
57+
-v $(GOPATH)/src:/go/src \
58+
-w /golang-cross-example \
59+
ghcr.io/gythialy/golang-cross:$(GO_BUILDER_VERSION) --snapshot --rm-dist
6460
```
6561

66-
## Practical example
62+
## Examples
6763

6864
- [.goreleaser.yml](example/.goreleaser.yml)
6965
- [Makefile](example/Makefile#L35-L42)
7066

71-
## Thanks
67+
## Alternative projects
7268

73-
[![Jetbrains](assets/jetbrains-variant-3.svg)](https://www.jetbrains.com/?from=golang-cross)
69+
- [goreleaser/goreleaser-cross](https://github.com/goreleaser/goreleaser-cross)

0 commit comments

Comments
 (0)