From 7093ac569eec7910d8e2d984ed64a519b8a3bbc0 Mon Sep 17 00:00:00 2001 From: binwiederhier Date: Sat, 7 Mar 2026 17:17:25 -0500 Subject: [PATCH] Dockers v2 --- .goreleaser.yml | 84 ++++++++++++++----------------------------------- Dockerfile | 14 +++++++-- Dockerfile-arm | 18 ----------- 3 files changed, 34 insertions(+), 82 deletions(-) delete mode 100644 Dockerfile-arm diff --git a/.goreleaser.yml b/.goreleaser.yml index 3c4e9c76..0638906f 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -54,9 +54,8 @@ builds: ldflags: - "-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}" goos: [ windows ] - goarch: [amd64 ] - - - id: ntfy_darwin_all + goarch: [ amd64 ] + - id: ntfy_darwin_all binary: ntfy env: - CGO_ENABLED=0 # explicitly disable, since we don't need go-sqlite3 @@ -67,8 +66,8 @@ builds: goarch: [ amd64, arm64 ] # will be combined to "universal binary" (see below) nfpms: - package_name: ntfy - homepage: https://heckel.io/ntfy - maintainer: Philipp C. Heckel + homepage: https://ntfy.sh + maintainer: Philipp C. Heckel description: Simple pub-sub notification service license: Apache 2.0 formats: @@ -148,59 +147,22 @@ changelog: exclude: - '^docs:' - '^test:' -dockers: - - image_templates: - - &amd64_image "binwiederhier/ntfy:{{ .Tag }}-amd64" - use: buildx - dockerfile: Dockerfile - goarch: amd64 - build_flag_templates: - - "--platform=linux/amd64" - - image_templates: - - &arm64v8_image "binwiederhier/ntfy:{{ .Tag }}-arm64v8" - use: buildx - dockerfile: Dockerfile-arm - goarch: arm64 - build_flag_templates: - - "--platform=linux/arm64/v8" - - image_templates: - - &armv7_image "binwiederhier/ntfy:{{ .Tag }}-armv7" - use: buildx - dockerfile: Dockerfile-arm - goarch: arm - goarm: 7 - build_flag_templates: - - "--platform=linux/arm/v7" - - image_templates: - - &armv6_image "binwiederhier/ntfy:{{ .Tag }}-armv6" - use: buildx - dockerfile: Dockerfile-arm - goarch: arm - goarm: 6 - build_flag_templates: - - "--platform=linux/arm/v6" -docker_manifests: - - name_template: "binwiederhier/ntfy:latest" - image_templates: - - *amd64_image - - *arm64v8_image - - *armv7_image - - *armv6_image - - name_template: "binwiederhier/ntfy:{{ .Tag }}" - image_templates: - - *amd64_image - - *arm64v8_image - - *armv7_image - - *armv6_image - - name_template: "binwiederhier/ntfy:v{{ .Major }}" - image_templates: - - *amd64_image - - *arm64v8_image - - *armv7_image - - *armv6_image - - name_template: "binwiederhier/ntfy:v{{ .Major }}.{{ .Minor }}" - image_templates: - - *amd64_image - - *arm64v8_image - - *armv7_image - - *armv6_image +dockers_v2: + - dockerfile: Dockerfile + ids: + - ntfy_linux_amd64 + - ntfy_linux_armv6 + - ntfy_linux_armv7 + - ntfy_linux_arm64 + images: + - "binwiederhier/ntfy" + tags: + - "latest" + - "{{ .Tag }}" + - "v{{ .Major }}" + - "v{{ .Major }}.{{ .Minor }}" + platforms: + - linux/amd64 + - linux/arm64 + - linux/arm/v7 + - linux/arm/v6 diff --git a/Dockerfile b/Dockerfile index 45dad05d..2d47f5d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,9 @@ +FROM --platform=$BUILDPLATFORM alpine AS tzdata +RUN apk add --no-cache tzdata + FROM alpine -LABEL org.opencontainers.image.authors="philipp.heckel@gmail.com" +LABEL org.opencontainers.image.authors="Philipp C. Heckel " LABEL org.opencontainers.image.url="https://ntfy.sh/" LABEL org.opencontainers.image.documentation="https://docs.ntfy.sh/" LABEL org.opencontainers.image.source="https://github.com/binwiederhier/ntfy" @@ -9,8 +12,13 @@ LABEL org.opencontainers.image.licenses="Apache-2.0, GPL-2.0" LABEL org.opencontainers.image.title="ntfy" LABEL org.opencontainers.image.description="Send push notifications to your phone or desktop using PUT/POST" -RUN apk add --no-cache tzdata -COPY ntfy /usr/bin +ARG TARGETPLATFORM + +# Install tzdata in a separate stage using the build platform to avoid +# needing QEMU to run "apk add" for non-native target architectures +COPY --from=tzdata /usr/share/zoneinfo /usr/share/zoneinfo + +COPY $TARGETPLATFORM/ntfy /usr/bin/ntfy EXPOSE 80/tcp ENTRYPOINT ["ntfy"] diff --git a/Dockerfile-arm b/Dockerfile-arm deleted file mode 100644 index 755092fd..00000000 --- a/Dockerfile-arm +++ /dev/null @@ -1,18 +0,0 @@ -FROM alpine - -LABEL org.opencontainers.image.authors="philipp.heckel@gmail.com" -LABEL org.opencontainers.image.url="https://ntfy.sh/" -LABEL org.opencontainers.image.documentation="https://docs.ntfy.sh/" -LABEL org.opencontainers.image.source="https://github.com/binwiederhier/ntfy" -LABEL org.opencontainers.image.vendor="Philipp C. Heckel" -LABEL org.opencontainers.image.licenses="Apache-2.0, GPL-2.0" -LABEL org.opencontainers.image.title="ntfy" -LABEL org.opencontainers.image.description="Send push notifications to your phone or desktop using PUT/POST" - -# Alpine does not support adding "tzdata" on ARM anymore, see -# https://github.com/binwiederhier/ntfy/issues/894 - -COPY ntfy /usr/bin - -EXPOSE 80/tcp -ENTRYPOINT ["ntfy"]