Skip to content

Instantly share code, notes, and snippets.

@tyler-smith
Created October 30, 2018 05:47
Show Gist options
  • Save tyler-smith/a5bc92f6c14fced38ccf50a75fb5a603 to your computer and use it in GitHub Desktop.
Save tyler-smith/a5bc92f6c14fced38ccf50a75fb5a603 to your computer and use it in GitHub Desktop.
bchd dnsseeder optimized Dockerfile
# Start from a Debian image with the latest version of Go installed
# and a workspace (GOPATH) configured at /go.
FROM golang
LABEL maintainer="Josh Ellithorpe <[email protected]>"
WORKDIR /go/src/github.com/gcash/dnsseeder
# Install dep
RUN go get -u github.com/golang/dep/cmd/dep
# Copy the local package files to the container's workspace.
COPY . .
# Restore vendored packages.
RUN dep ensure
# Build static binary for 64bit Linux
RUN CGO_ENABLED=0 go build --ldflags '-extldflags "-static"' -o /bin/dnsseeder .
# Create final image
FROM scratch
WORKDIR /var/lib/dnsseeder
# Document that the service listens on port 53.
EXPOSE 53
EXPOSE 53/udp
# Copy binary, configs, and SSL CA certs from build image to final image
COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=0 /go/src/github.com/gcash/dnsseeder/configs/ ./configs/
COPY --from=0 /go/src/github.com/gcash/dnsseeder/mainnet-*.json ./
COPY --from=0 /bin/dnsseeder /bin/dnsseeder
# Start dnsseeder
ENTRYPOINT ["/bin/dnsseeder", "-s", "-d", "-netfile=mainnet-all.json,mainnet-filtered.json"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment