-
Notifications
You must be signed in to change notification settings - Fork 101
/
Dockerfile.distroless
42 lines (31 loc) · 1.17 KB
/
Dockerfile.distroless
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Building stage
# Start from a Debian image with the latest version of Go installed
# and a workspace (GOPATH) configured at /go.
FROM golang as builder
LABEL maintainer="Josh Ellithorpe <quest@mac.com>"
# Copy the local package files to the container's workspace.
ADD . /go/src/github.com/gcash/bchd
# Switch to the correct working directory.
WORKDIR /go/src/github.com/gcash/bchd
# Build the code and the cli client.
RUN go install .
RUN go install ./cmd/bchctl
# Symlink the config to /root/.bchd/bchd.conf
# so bchctl requires fewer flags.
RUN mkdir -p /root/.bchd
RUN ln -s /data/bchd.conf /root/.bchd/bchd.conf
# Final stage
FROM gcr.io/distroless/base
LABEL maintainer="Josh Ellithorpe <quest@mac.com>"
# Copy necessary files
COPY --from=builder /go/bin/bchd /usr/local/bin/bchd
COPY --from=builder /go/bin/bchctl /usr/local/bin/bchctl
COPY --from=builder /root /root
# Create the data volume.
VOLUME ["/data"]
# Set the start command. This starts bchd with
# flags to save the blockchain data and the
# config on a docker volume.
ENTRYPOINT ["bchd", "--addrindex", "--txindex", "-b", "/data", "-C", "/data/bchd.conf"]
# Document that the service listens on port 8333.
EXPOSE 8333