mirror of
https://github.com/binwiederhier/ntfy.git
synced 2024-12-29 03:45:05 +03:00
11f8984127
I’d like to test #751 on my own instance, but installing all the build dependencies on my server isn’t ideal - having this script in the repo would make it possible to simply point my compose file to the git repo and have it build the Linux binary itself. Note that it uses a somewhat “inefficient” builder step, i.e. not combining steps together to reduce layers, as it uses a multi-stage build to have a lean final image. This makes it easier to re-build if something needs to change, as the cache is used more optimally. For example, if only some go files change, most of the build is already cached and only the go step gets re-run. The more “efficient” builder step would look like this, but would have to build the docs, web app and go CLI for any change in any file: ```Dockerfile FROM golang:1.19-bullseye as builder RUN apt-get update && \ curl -fsSL https://deb.nodesource.com/setup_18.x | bash && \ apt-get install -y \ build-essential \ nodejs \ python3-pip WORKDIR /app ADD . . RUN make web docs cli-linux-server ```
54 lines
1.3 KiB
Plaintext
54 lines
1.3 KiB
Plaintext
FROM golang:1.19-bullseye as builder
|
|
|
|
ARG VERSION=dev
|
|
ARG COMMIT=unknown
|
|
|
|
RUN apt-get update
|
|
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash
|
|
RUN apt-get install -y \
|
|
build-essential \
|
|
nodejs \
|
|
python3-pip
|
|
|
|
WORKDIR /app
|
|
ADD Makefile .
|
|
|
|
# docs
|
|
ADD ./requirements.txt .
|
|
RUN make docs-deps
|
|
ADD ./mkdocs.yml .
|
|
ADD ./docs ./docs
|
|
RUN make docs-build
|
|
|
|
# web
|
|
ADD ./web/package.json ./web/package-lock.json ./web/
|
|
RUN make web-deps
|
|
ADD ./web ./web
|
|
RUN make web-build
|
|
|
|
# cli & server
|
|
ADD go.mod go.sum main.go ./
|
|
ADD ./client ./client
|
|
ADD ./cmd ./cmd
|
|
ADD ./log ./log
|
|
ADD ./server ./server
|
|
ADD ./user ./user
|
|
ADD ./util ./util
|
|
RUN make VERSION=$VERSION COMMIT=$COMMIT cli-linux-server
|
|
|
|
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"
|
|
|
|
COPY --from=builder /app/dist/ntfy_linux_server/ntfy /usr/bin/ntfy
|
|
|
|
EXPOSE 80/tcp
|
|
ENTRYPOINT ["ntfy"]
|