dcrd/Dockerfile.alpine
Naveen 061b10bb51
build: Pin docker images with SHA instead of tag.
* Pinned the docker images to be based on SHA instead of tags.
* https://github.com/ossf/scorecard/blob/main/docs/checks.md#pinned-dependencies
* Tags can be moved which poses a security risk.

Included comments with the actual image name.
2021-09-14 08:36:56 -05:00

57 lines
1.4 KiB
Docker

# alpine:3.14.0
# Build image
FROM golang@sha256:7dbfeb9d51c049e8bfe36cf1a4217c7b1ba304bf0eb72d57d0c04f405589f122
#
# 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 . .
RUN CGO_ENABLED=0 GOOS=linux go install . ./cmd/...
# Production image
FROM alpine@sha256:adab3844f497ab9171f070d4cae4114b5aec565ac772e2f2579405b78be67c96
RUN apk add --no-cache ca-certificates
COPY --from=0 /go/bin/* /bin/
# mainnet
EXPOSE 9108 9109
# testnet
EXPOSE 19108 19109
# simnet
EXPOSE 18555 19556
CMD [ "dcrd" ]