gotify / gotify/build

Make a statically linked build

Open
#17 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Makefile
Stars
6
Forks
9
PR merge metrics
No merged PRs in 30d

Description

Currently none of the official builds will work on Alpine, we should have a statically linked build. sqlite3 is public domain so I don't think there should be non-technical complications, something like this (and changing the server build script to append not overwrite LD_FLAGS) should work.

```dockerfile
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 LD_FLAGS="-linkmode external -extldflags '-static'"
ENV CC=musl-gcc

LABEL org.opencontainers.image.source="https://github.com/gotify/build" \
org.opencontainers.image.revision=$VCS_REF

```

However since there are no system libc dependencies here or plugin compatibility issues (it's not a dynamically linked system so no plugins), another options is to simply don't use docker at all and build a strictly statically linked binary straight from GH Actions, but out of consistency I think going with docker is good.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.