dennis-tra / nebula

🌌 A network agnostic DHT crawler, monitor, and measurement tool that exposes timely information about DHT networks.
Apache License 2.0
318 stars 33 forks source link

Add ghcr.io/gorelease-cross docker to cross-compile binaries #66

Closed cortze closed 6 months ago

cortze commented 6 months ago

Description

The compilation of Nebula requires some CGO dependencies, which heavily complicate the cross-compilation efforts. This PR aims to solve #60 using the Docker images provided by goreleaser/goreleaser-cross

NOTE: Super important to rely on the ghcr.io/gorelease-cross images, as there are some C libs missing at the DockerHub images. :(

Proof of Success

The compilation works fine locally (with the listed GOOS and GOARCH) when running:

docker run --rm \
    -v ./:/workspace \
    -w /workspace \
    -v /var/run/docker.sock:/var/run/docker.sock \
    ghcr.io/goreleaser/goreleaser-cross:v1.19.6 build --snapshot --clean --config .goreleaser.yaml

which reports:

  • starting build...
  • loading config file                              file=.goreleaser.yaml
  • loading environment variables
  • getting and validating git state
    • building...                                    commit=a38f2d58da9ea1b7f093c5719db3420ad27d9867 latest tag=2.2.1
    • pipe skipped                                   reason=disabled during snapshot mode
  • parsing tag
  • setting defaults
  • running before hooks
    • running                                        hook=go mod tidy
    • running                                        hook=go run ./cmd/prefix/gen.go
    • took: 17s
  • snapshotting
    • building snapshot...                           version=2.2.1-SNAPSHOT-a38f2d5
  • checking distribution directory
    • cleaning dist
  • loading go mod information
  • build prerequisites
  • writing effective config file
    • writing                                        config=dist/config.yaml
  • building binaries
    • building                                       binary=dist/darwin-arm64_darwin_arm64/nebula-darwin-arm64
    • building                                       binary=dist/darwin-amd64_darwin_amd64_v1/nebula-darwin-amd64
    • building                                       binary=dist/linux-arm64_linux_arm64/nebula-linux-arm64
    • building                                       binary=dist/linux-amd64_linux_amd64_v1/nebula-linux-amd64
    • building                                       binary=dist/windows-amd64_windows_amd64_v1/nebula-win-amd64.exe
    • took: 3m32s
  • storing release metadata
    • writing                                        file=dist/artifacts.json
    • writing                                        file=dist/metadata.json
  • build succeeded after 3m49s

Just hoping that there is nothing broken at the GitHub Actions integration (fingerscrossed)

Sorry for the spam @dennis-tra , Let me know if there is anything easier/less spammer to try out the github-actions integrations :(