goreleaser / goreleaser

Deliver Go binaries as fast and easily as possible
https://goreleaser.com
MIT License
13.62k stars 926 forks source link

Releasing a debian-based official Goreleaser container image #4968

Closed Nicolas-Peiffer closed 2 months ago

Nicolas-Peiffer commented 2 months ago

Is your feature request related to a problem? Please describe.

The current goreleaser official image docker.io/goreleaser/goreleaser is based on the Golang Alpine image like docker.io/golang:1.22.4-alpine ( source goreleaser/Dockerfile ).

I would like to have the choice between an Alpine-based goreleaser official image and a Debian-based goreleaser official image.

The debian-based goreleaser official image could be based on the on the Golang debian image like docker.io/golang:1.22.4-bookworm.

One of the reason is the support of glibc by debian and libc-musl by Alpine. And sometimes I need CGO enabled and I need standard glibc and not the musl one.

On GitHUB actions when using Goreleaser, I do not have this musl libc issue, since GitHUB linux runners are Ubuntu-based.

Describe the solution you'd like

The debian-based goreleaser official image could be based on the on the Golang debian image like docker.io/golang:1.22.4-bookworm.

Describe alternatives you've considered

Today, to compensate for the lack of an official debian-based goreleaser image on docker.io/goreleaser/goreleaser, I create my own custom Goreleaser image thanks to a Gitlab-ci job.

I use the debian-based version of docker.io/golang as base image, and I install goreleaser and some tools like cosign, ko-build and trivy on top of the base image.

I could create my own image outside of the Gitlab-ci job, but I do not want to maintain a custom Goreleaser image.

However, having a pre-build debian-based goreleaser image would make my CI pipeline faster, as I don't have to wait for goreleaser, cosign, ko-build and trivy to finish install. It also is friendlier for my network.

# .gitlab-ci.yml
release:
  stage: goreleaser
  image:
    # We are not using the docker.io/goreleaser/goreleaser image because it is
    # based on Alpine and it uses libc.musl-x86_64.so.1
    name: docker.io/golang:1.22.4-bookworm
    entrypoint: [""]
  only:
    - tags
  variables:
    WORKSPACE: $CI_PROJECT_DIR
    CI_DEBUG_TRACE: "true"
    RUNNER_GENERATE_ARTIFACTS_METADATA: "true"
    GIT_DEPTH: 0
    GITLAB_TOKEN: $GITLAB_TOKEN
    CI_JOB_TOKEN: $CI_JOB_TOKEN
  before_script: 
    - go install github.com/goreleaser/goreleaser/v2@latest
    - go install github.com/sigstore/cosign/v2/cmd/cosign@latest
    - go install github.com/google/ko@latest
    - curl -sSfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.49.1
    - ko login $CI_REGISTRY -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD
  script:
    - make release

On GitHUB actions, I do not have this musl libc issue since GitHUB linux runners are Ubuntu-based.

Search

Supporter

Code of Conduct

Additional context

No response

caarlos0 commented 2 months ago

if you are trying to use CGO, you'll need more than just using a debian-based image.

check: https://goreleaser.com/cookbooks/cgo-and-crosscompiling

caarlos0 commented 2 months ago

that said, with cgo disabled, there's not good reason to switch to debian, so I'll close this.