Skip to content

Commit

Permalink
docs: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
gythialy committed Jan 5, 2021
1 parent ba523fd commit 94a4737
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 7 deletions.
47 changes: 40 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
# golang-cross [![Actions Status](https://github.com/gythialy/golang-cross/workflows/Docker%20Image%20CI/badge.svg)](https://github.com/gythialy/golang-cross/actions)

Docker container to do cross compilation (Linux, windows, macOS, ARM, ARM64) of go packages including support for cgo.
Docker container to do cross compilation (Linux, windows, macOS, ARM, ARM64) of go packages including support for cgo.

## Docker
## Docker images

Find it on docker hub https://hub.docker.com/r/goreng/golang-cross or run
- Find it on docker hub

- [golang-cross](https://hub.docker.com/r/goreng/golang-cross)
```
docker pull goreng/golang-cross
```
- [golang-cross-builder](https://hub.docker.com/r/goreng/golang-cross-builder)
```
docker pull goreng/golang-cross-builder
```
- Build your own images
- Build base image (optional)
```
docker build -f Dockerfile_builder -t goreng/golang-cross-builder:1.15.1 .
```
> Please follow the guide to [pack the SDK](https://github.com/tpoechtrager/osxcross#packaging-the-sdk) first
- Build golang-cross image
```
docker build --build-arg GOLANG_VERSION=1.15.6 --build-arg GOLANG_DIST_SHA=3918e6cc85e7eaaa6f859f1bdbaac772e7a825b0eb423c63d3ae68b21f84b844 --build-arg GORELEASER_VERSION=0.149.0 --build-arg GORELEASER_SHA=a227362d734cda47f7ebed9762e6904edcd115a65084384ecfbad2baebc4c775 -f Dockerfile -t goreng/golang-cross .
```
> The default arguments can be overridden with `--build-arg`
## How to use
- Prepare [GoReleaser](https://goreleaser.com/intro/) configuration
- Generate environment variable `PRIVATE_KEY` from the GPG private key (optional), if enable the [signing](https://goreleaser.com/customization/sign/) feature
- generate evn var from file

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

- run docker container
- Run docker container to build the binaries

```bash
docker run --rm --privileged \
-e PRIVATE_KEY=${PRIVATE_KEY} \
Expand All @@ -22,3 +46,12 @@ Find it on docker hub https://hub.docker.com/r/goreng/golang-cross or run
-w /go/src/github.com/qlcchain/go-qlc \
goreng/golang-cross:latest --snapshot --rm-dist
```

## Practical Examples

- [.goreleaser.yml](https://github.com/qlcchain/go-qlc/blob/master/.goreleaser.yml)
- [Makefile](https://github.com/qlcchain/go-qlc/blob/master/Makefile#L50-L67)

## Thanks

[![Jetbrains](assets/jetbrains-variant-3.svg)](https://www.jetbrains.com/?from=golang-cross)
73 changes: 73 additions & 0 deletions assets/jetbrains-variant-3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 94a4737

Please sign in to comment.