Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,29 @@ LABEL org.opencontainers.image.documentation=https://gotify.net/
LABEL org.opencontainers.image.source=https://github.com/gotify/server

# Build-time configurables
ARG GOTIFY_SERVER_EXPOSE=80
ARG GOTIFY_SERVER_EXPOSE=8080
ENV GOTIFY_SERVER_PORT=$GOTIFY_SERVER_EXPOSE
ENV GOTIFY_USER=""
ENV GOTIFY_GROUP=""

WORKDIR /app

RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get install -yq --no-install-recommends \
tzdata \
curl \
ca-certificates && \
ca-certificates \
gosu && \
rm -rf /var/lib/apt/lists/*

HEALTHCHECK --interval=30s --timeout=5s --start-period=5s CMD curl --fail http://localhost:$GOTIFY_SERVER_PORT/health || exit 1
EXPOSE $GOTIFY_SERVER_EXPOSE

COPY --from=builder /target /
COPY docker/entrypoint.sh /app/entrypoint.sh

RUN chmod +x /app/entrypoint.sh && \
mkdir -p /app/data && \
chmod 0750 /app/data

ENTRYPOINT ["./gotify-app"]
ENTRYPOINT ["./entrypoint.sh"]
CMD ["serve"]
10 changes: 10 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -e

if [ -n "${GOTIFY_USER:-}" ] && [ "$(id -u)" = "0" ]; then
mkdir -p data
chown -R "$GOTIFY_USER:${GOTIFY_GROUP:-$GOTIFY_USER}" data
exec gosu "$GOTIFY_USER:${GOTIFY_GROUP:-$GOTIFY_USER}" ./gotify-app "$@"
fi

exec ./gotify-app "$@"
2 changes: 1 addition & 1 deletion gotify-server.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

# Port the HTTP server listens on.
# Type: number
# GOTIFY_SERVER_PORT=80
# GOTIFY_SERVER_PORT=8080

# Enable the HTTPS listener. Requires either CERTFILE+CERTKEY or LETSENCRYPT_ENABLED=true.
# Type: boolean
Expand Down