diff --git a/Dockerfile b/Dockerfile index a4a73660..1904cfd8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,48 @@ FROM golang:1.12 +# +# NOTE: The RPC server listens on localhost by default. +# If you require access to the RPC server, +# rpclisten should be set to an empty value. +# +# NOTE: When running simnet, you may not want to preserve +# the data and logs. This can be achieved by specifying +# a location outside the default ~/.dcrd. For example: +# rpclisten= +# simnet=1 +# datadir=~/simnet-data +# logdir=~/simnet-logs +# +# Example testnet instance with RPC server access: +# $ mkdir -p /local/path/dcrd +# +# Place a dcrd.conf into a local directory, i.e. /var/dcrd +# $ mv dcrd.conf /var/dcrd +# +# Verify basic configuration +# $ cat /var/dcrd/dcrd.conf +# rpclisten= +# testnet=1 +# +# Build the docker image +# $ docker build -t user/dcrd . +# +# Run the docker image, mapping the testnet dcrd RPC port. +# $ docker run -d --rm -p 127.0.0.1:19109:19109 -v /var/dcrd:/root/.dcrd user/dcrd +# + WORKDIR /go/src/github.com/decred/dcrd COPY . . RUN env GO111MODULE=on go install . ./cmd/... -EXPOSE 9108 -EXPOSE 9109 -EXPOSE 19108 -EXPOSE 19109 -EXPOSE 18555 -EXPOSE 19556 +# mainnet +EXPOSE 9108 9109 + +# testnet +EXPOSE 19108 19109 + +# simnet +EXPOSE 18555 19556 CMD [ "dcrd" ] diff --git a/Dockerfile.alpine b/Dockerfile.alpine index 162b476b..ea64712c 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -1,5 +1,36 @@ # Build image -FROM golang:1.11 +FROM golang:1.12 + +# +# NOTE: The RPC server listens on localhost by default. +# If you require access to the RPC server, +# rpclisten should be set to an empty value. +# +# NOTE: When running simnet, you may not want to preserve +# the data and logs. This can be achieved by specifying +# a location outside the default ~/.dcrd. For example: +# rpclisten= +# simnet=1 +# datadir=~/simnet-data +# logdir=~/simnet-logs +# +# Example testnet instance with RPC server access: +# $ mkdir -p /local/path/dcrd +# +# Place a dcrd.conf into a local directory, i.e. /var/dcrd +# $ mv dcrd.conf /var/dcrd +# +# Verify basic configuration +# $ cat /var/dcrd/dcrd.conf +# rpclisten= +# testnet=1 +# +# Build the docker image +# $ docker build -t user/dcrd -f Dockerfile.alpine . +# +# Run the docker image, mapping the testnet dcrd RPC port. +# $ docker run -d --rm -p 127.0.0.1:19109:19109 -v /var/dcrd:/root/.dcrd user/dcrd +# WORKDIR /go/src/github.com/decred/dcrd COPY . . @@ -7,11 +38,18 @@ COPY . . RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on go install . ./cmd/... # Production image -FROM alpine:3.6 +FROM alpine:3.10.1 RUN apk add --no-cache ca-certificates COPY --from=0 /go/bin/* /bin/ -EXPOSE 9108 +# mainnet +EXPOSE 9108 9109 + +# testnet +EXPOSE 19108 19109 + +# simnet +EXPOSE 18555 19556 CMD [ "dcrd" ]