- scripts/e2e.sh (+ scripts/e2e/*.ts): the two-node end-to-end test, now self-contained and cleaning up after itself; `make e2e`, part of `make check` - Dockerfile/.dockerignore: static Go build in a non-root alpine image, data in /data, defaults to region u1j; `make docker` - flake.nix, nix/: package (buildGoModule), dev shell, NixOS module services.allmende (hardened systemd unit that waits for `allmende-admin init`), and a NixOS VM test run by `nix flake check` - README: running a node with Docker and NixOS Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
36 lines
1.5 KiB
Docker
36 lines
1.5 KiB
Docker
# Allmende node. The web UI is already built and embedded (web/dist is
|
|
# committed), so only Go is needed here.
|
|
#
|
|
# docker build -t allmende .
|
|
# docker run --rm -it -v allmende-data:/data allmende init # once; shows the recovery phrase
|
|
# docker run -d --name allmende -v allmende-data:/data \
|
|
# -p 127.0.0.1:8080:8080 -p 4001:4001 allmende # run (Bonn by default)
|
|
#
|
|
# The HTTP port also serves the owner API, which the admin token protects, so
|
|
# publish it on 127.0.0.1 only and put a TLS proxy in front for public use.
|
|
# Port 4001 is the libp2p port other nodes connect to.
|
|
|
|
ARG GO_VERSION=1.27
|
|
|
|
FROM golang:${GO_VERSION}-alpine AS build
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY . .
|
|
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/allmende ./cmd/allmende
|
|
|
|
FROM alpine:3.22
|
|
RUN adduser -D -u 10001 allmende && mkdir /data && chown allmende /data
|
|
COPY --from=build /out/allmende /usr/local/bin/allmende
|
|
USER allmende
|
|
ENV ALLMENDE_DATA=/data
|
|
VOLUME /data
|
|
EXPOSE 8080 4001
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s \
|
|
CMD wget -qO- http://127.0.0.1:8080/api/v1/status >/dev/null || exit 1
|
|
ENTRYPOINT ["allmende"]
|
|
# Override the whole command to change regions or add peers, e.g.
|
|
# docker run ... allmende run --http 0.0.0.0:8080 --listen /ip4/0.0.0.0/tcp/4001 \
|
|
# --region u1j --region u1h --bootstrap /ip4/203.0.113.5/tcp/4001/p2p/<peer id>
|
|
CMD ["run", "--http", "0.0.0.0:8080", "--listen", "/ip4/0.0.0.0/tcp/4001", "--region", "u1j"]
|