Skip to content

Build with CGO_ENABLED=0 #24658

Open
Open
@silverwind

Description

@silverwind

Feature Description

We should aim to build with CGO_ENABLED=0, which brings benefits:

  • The resulting binary is statically linked and can run inside docker from: scratch images, which is ideal for security and image size because it only has the binary in the container, nothing else.
  • xgo can be removed because without CGO, go can cross-compile everything itself.
  • When CGO is enabled, go will switch to a suboptimal and toolchain and afaik also produce suboptimal binaries.

What are the remaining dependencies here? Just sqlite, or is there more?

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic/buildPR changes how Gitea is built, i.e. regarding Docker or the Makefiletype/enhancementAn improvement of existing functionalitytype/proposalThe new feature has not been accepted yet but needs to be discussed first.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions