diff --git a/.github/workflows/redhat-certify.yml b/.github/workflows/redhat-certify.yml index c6cd62bca..763da745d 100644 --- a/.github/workflows/redhat-certify.yml +++ b/.github/workflows/redhat-certify.yml @@ -34,6 +34,7 @@ on: - reverse-proxy - netbird-server - signal + - relay version: description: "Released version, e.g. v0.80.0" type: string @@ -70,6 +71,7 @@ jobs: "reverse-proxy ghcr.io/netbirdio/reverse-proxy -ubi" "netbird-server ghcr.io/netbirdio/netbird-server -ubi" "signal ghcr.io/netbirdio/signal -ubi" + "relay ghcr.io/netbirdio/relay -ubi" ) matrix="[]" missing=() diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 1e7acbaa7..785bc452a 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -506,6 +506,41 @@ dockers_v2: "org.opencontainers.image.revision": "{{.FullCommit}}" "org.opencontainers.image.source": "{{.GitURL}}" "maintainer": "dev@netbird.io" + - id: relay-ubi + disable: "{{ .Env.SKIP_DOCKER_PUSH }}" + ids: + - netbird-relay + images: + - netbirdio/relay + - ghcr.io/netbirdio/relay + tags: + - "{{ .Version }}-ubi" + - "{{ if eq .Env.SKIP_PUBLISH \"false\" }}ubi-latest{{ end }}" + dockerfile: relay/Dockerfile.ubi + platforms: + - linux/amd64 + - linux/arm64 + build_args: + VERSION: "{{ .Version }}" + RELEASE: "{{ .Timestamp }}" + hooks: + pre: + - cmd: 'sh release_files/collect-licenses.sh -l relay/LICENSE "{{ .ContextDir }}/licenses" ./relay amd64 arm64' + env: + - GOOS=linux + - CGO_ENABLED=0 + labels: + "org.opencontainers.image.created": "{{.Date}}" + "org.opencontainers.image.version": "{{.Version}}" + "org.opencontainers.image.revision": "{{.FullCommit}}" + "org.opencontainers.image.source": "{{.GitURL}}" + annotations: + "org.opencontainers.image.created": "{{.Date}}" + "org.opencontainers.image.title": "{{.ProjectName}}" + "org.opencontainers.image.version": "{{.Version}}" + "org.opencontainers.image.revision": "{{.FullCommit}}" + "org.opencontainers.image.source": "{{.GitURL}}" + "maintainer": "dev@netbird.io" - id: signal disable: "{{ .Env.SKIP_DOCKER_PUSH }}" ids: diff --git a/relay/Dockerfile.ubi b/relay/Dockerfile.ubi new file mode 100644 index 000000000..86b0cbc01 --- /dev/null +++ b/relay/Dockerfile.ubi @@ -0,0 +1,33 @@ +FROM registry.access.redhat.com/ubi9/ubi-minimal@sha256:7fbeae18dc9476399f565e68255f602a3374ea8614ba3d14843565131a13ff93 + +ARG TARGETPLATFORM +ARG VERSION=dev +ARG RELEASE=1 + +LABEL name="netbird-relay" \ + maintainer="NetBird " \ + vendor="NetBird GmbH" \ + version="${VERSION}" \ + release="${RELEASE}" \ + summary="NetBird Relay" \ + description="NetBird Relay carries traffic between peers when a direct connection is unavailable." + +COPY --chmod=0555 ${TARGETPLATFORM}/netbird-relay /go/bin/netbird-relay +COPY licenses/ /licenses/ +# Only the data directory shares the root group for arbitrary non-root UIDs. +# Runtime-created Let's Encrypt keys retain the application's restrictive modes. +RUN mkdir -p /var/lib/netbird && \ + chown 1000:0 /var/lib/netbird && \ + chmod 0770 /var/lib/netbird && \ + chmod -R a+rX /licenses + +USER 1000:0 +ENV HOME=/var/lib/netbird +ENV NB_LOG_FILE=console +# Unprivileged port: runtimes such as OpenShift and Podman keep the kernel +# default that reserves ports below 1024 for root. 8443/udp carries QUIC and +# 9000 is the health probe. +ENV NB_LISTEN_ADDRESS=":8443" +EXPOSE 8443 8443/udp +STOPSIGNAL SIGTERM +ENTRYPOINT ["/go/bin/netbird-relay"]