Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Dockerfile.linux-amd64-musl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ARG GO_VERSION
FROM gotify/build:$GO_VERSION-linux-amd64
ARG VCS_REF
RUN \
apt-get update && \
apt-get install -y musl-tools

ENV CGO_ENABLED=1
ENV GOOS=linux
ENV GOARCH=amd64
ENV GO_EXTRA_LDFLAGS="-linkmode external -extldflags '-static'"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a standard Go environment variable correct? I think I'll wait for the gotify/server changes required to make this work. Without the big picture this is difficult to review.

Copy link
Member Author

@eternal-flame-AD eternal-flame-AD Aug 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we have to add this to the Makefile. My testing is simply add this to DOCKER_GO_BUILD and it builds correctly.

If you agree with the plugin transition I think let's just get the plugin issue out of the way first to fix the documentation issue, I tried finding a way to query at runtime whether the program is statically linked it isn't that simple, I don't want to add a permanent magic linker flag to solve a temporary problem.

ENV CC=musl-gcc

LABEL org.opencontainers.image.source="https://github.com/gotify/build" \
org.opencontainers.image.revision=$VCS_REF
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PROJECT=gotify/build
PROJECT=docker.io/gotify/build
GO_VERSION?=$(shell cat GO_VERSION)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: I'll wait on musl support for the next gotify/server release.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eternal-flame-AD FYI: I'll create a release today, as the new plugin support probably will take some time to fully work.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay!

VCS_REF=$(shell git describe --tags --always)

Expand All @@ -20,6 +20,12 @@ build-linux-amd64:
push-linux-amd64:
docker push ${PROJECT}:${GO_VERSION}-linux-amd64

build-linux-amd64-musl:
docker build --build-arg VCS_REF=${VCS_REF} --build-arg GO_VERSION=${GO_VERSION} -t ${PROJECT}:${GO_VERSION}-linux-amd64-musl -f Dockerfile.linux-amd64-musl .

push-linux-amd64-musl:
docker push ${PROJECT}:${GO_VERSION}-linux-amd64-musl

build-linux-386:
docker build --build-arg VCS_REF=${VCS_REF} --build-arg GO_VERSION=${GO_VERSION} -t ${PROJECT}:${GO_VERSION}-linux-386 -f Dockerfile.linux-386 .

Expand All @@ -44,5 +50,5 @@ build-linux-riscv64:
push-linux-riscv64:
docker push ${PROJECT}:${GO_VERSION}-linux-riscv64

build: build-linux-amd64 build-linux-arm-7 build-linux-arm64 build-linux-riscv64 build-linux-386 build-windows-amd64 build-windows-386
push: push-linux-amd64 push-linux-arm-7 push-linux-arm64 push-linux-riscv64 push-linux-386 push-windows-amd64 push-windows-386
build: build-linux-amd64 build-linux-amd64-musl build-linux-arm-7 build-linux-arm64 build-linux-riscv64 build-linux-386 build-windows-amd64 build-windows-386
push: push-linux-amd64 push-linux-amd64-musl push-linux-arm-7 push-linux-arm64 push-linux-riscv64 push-linux-386 push-windows-amd64 push-windows-386