| 1 |
FROM golang:1.25-bookworm AS builder |
| 2 |
|
| 3 |
ARG VERSION=dev |
| 4 |
ARG COMMIT=unknown |
| 5 |
ARG NODE_MAJOR=24 |
| 6 |
|
| 7 |
RUN apt-get update && apt-get install -y \ |
| 8 |
build-essential ca-certificates curl gnupg \ |
| 9 |
&& mkdir -p /etc/apt/keyrings \ |
| 10 |
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ |
| 11 |
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" >> /etc/apt/sources.list.d/nodesource.list \ |
| 12 |
&& apt-get update \ |
| 13 |
&& apt-get install -y \ |
| 14 |
python3-pip \ |
| 15 |
python3-venv \ |
| 16 |
nodejs \ |
| 17 |
&& rm -rf /var/lib/apt/lists/* |
| 18 |
|
| 19 |
WORKDIR /app |
| 20 |
ADD Makefile . |
| 21 |
|
| 22 |
# docs |
| 23 |
ADD ./requirements.txt . |
| 24 |
RUN --mount=type=cache,target=/root/.cache/pip make docs-deps |
| 25 |
ADD ./mkdocs.yml . |
| 26 |
ADD ./docs ./docs |
| 27 |
RUN make docs-build |
| 28 |
|
| 29 |
# web |
| 30 |
ADD ./web/package.json ./web/package-lock.json ./web/ |
| 31 |
RUN --mount=type=cache,target=/root/.npm make web-deps |
| 32 |
ADD ./web ./web |
| 33 |
RUN make web-build |
| 34 |
|
| 35 |
# cli & server |
| 36 |
ADD go.mod go.sum main.go ./ |
| 37 |
ADD ./client ./client |
| 38 |
ADD ./cmd ./cmd |
| 39 |
ADD ./log ./log |
| 40 |
ADD ./server ./server |
| 41 |
ADD ./user ./user |
| 42 |
ADD ./util ./util |
| 43 |
ADD ./payments ./payments |
| 44 |
ADD ./db ./db |
| 45 |
ADD ./message ./message |
| 46 |
ADD ./model ./model |
| 47 |
ADD ./webpush ./webpush |
| 48 |
ADD ./attachment ./attachment |
| 49 |
ADD ./mail ./mail |
| 50 |
ADD ./s3 ./s3 |
| 51 |
ADD ./action ./action |
| 52 |
ADD ./template/gotext ./template/gotext |
| 53 |
|
| 54 |
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build make VERSION=$VERSION COMMIT=$COMMIT cli-linux-server |
| 55 |
|
| 56 |
FROM alpine |
| 57 |
|
| 58 |
ARG VERSION=dev |
| 59 |
|
| 60 |
LABEL org.opencontainers.image.authors="[email protected]" |
| 61 |
LABEL org.opencontainers.image.url="https://ntfy.sh/" |
| 62 |
LABEL org.opencontainers.image.documentation="https://docs.ntfy.sh/" |
| 63 |
LABEL org.opencontainers.image.source="https://github.com/binwiederhier/ntfy" |
| 64 |
LABEL org.opencontainers.image.vendor="Philipp C. Heckel" |
| 65 |
LABEL org.opencontainers.image.licenses="Apache-2.0, GPL-2.0" |
| 66 |
LABEL org.opencontainers.image.title="ntfy" |
| 67 |
LABEL org.opencontainers.image.description="Send push notifications to your phone or desktop using PUT/POST" |
| 68 |
LABEL org.opencontainers.image.version="$VERSION" |
| 69 |
|
| 70 |
COPY --from=builder /app/dist/ntfy_linux_server/ntfy /usr/bin/ntfy |
| 71 |
|
| 72 |
EXPOSE 80/tcp |
| 73 |
ENTRYPOINT ["ntfy"] |