From d5f03b4e26abc9dc21a0d62f366a221d83f0d5a3 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Tue, 9 May 2023 14:24:48 +0200 Subject: [PATCH] initial commit --- .gitignore | 3 +++ .woodpecker.yml | 11 +++++++++++ Dockerfile | 38 ++++++++++++++++++++++++++++++++++++++ README.md | 10 ++++++++++ 4 files changed, 62 insertions(+) create mode 100755 .gitignore create mode 100644 .woodpecker.yml create mode 100644 Dockerfile create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..af0faab --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*~ +.DS_Store +*.swp diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..3a7353a --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,11 @@ +pipeline: + publish-docker-image: + image: plugins/kaniko + settings: + repo: docker.io/thallian/ntfy + tags: latest,${CI_COMMIT_SHA:0:8},${CI_COMMIT_TAG=pre} + dockerfile: Dockerfile + username: + from_secret: DOCKER_USER + password: + from_secret: DOCKER_PW diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2eabe43 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +FROM docker.io/golang:1.20-alpine3.17 AS builder + +RUN echo "ntfy:x:2222:2222:Linux User,,,:/:/ntfy" > /passwd +RUN mkdir -p /data/attachments + +RUN apk --no-cache add \ + git \ + make \ + musl-dev \ + gcc \ + npm + +ENV VERSION=v2.4.0 +RUN git clone https://github.com/binwiederhier/ntfy.git + +WORKDIR /go/ntfy +RUN git checkout "$VERSION" + +RUN make web +RUN make web-build +RUN make cli-linux-server + + +FROM scratch + +COPY --from=builder /passwd /etc/passwd +COPY --from=builder --chown=2222:2222 /data /data +COPY --from=builder /go/ntfy/dist/ntfy_linux_server/ntfy /ntfy + +USER ntfy + +ENV NTFY_LISTEN_HTTP=:8080 +ENV NTFY_CACHE_FILE=/data/cache.db +ENV NTFY_ATTACHMENT_CACHE_DIR=/data/attachments +ENV NTFY_AUTH_FILE=/data/user.db +ENV NTFY_ENABLE_LOGIN=true + +CMD ["/ntfy", "serve", "-debug", "--trace"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..62ce24d --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +[ntfy](https://ntfy.sh/) pub-sub notifications service. + +# Volumes +- `/data`: storage dir for attachments and user data + +# Environment Variables +See the [docs](https://docs.ntfy.sh/config/#config-options) for configuration with environment variables. Set at least `NTFY_BASE_URL`. + +# Ports +- 8080