forked from ipfs/dht-node
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
40 lines (28 loc) · 1.11 KB
/
Dockerfile
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
FROM golang:1.14.2-alpine AS build
RUN apk add --no-cache openssl-dev git build-base
WORKDIR /hydra-booster
# We want to populate the module cache based on the go.{mod,sum} files.
COPY go.mod go.sum ./
#This is the ‘magic’ step that will download all the dependencies that are specified in
# the go.mod and go.sum file.
# Because of how the layer caching system works in Docker, the go mod download
# command will _ only_ be re-run when the go.mod or go.sum file change
# (or when we add another docker instruction this line)
RUN go mod download && go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get -v
# Copy the source from the current directory
# to the Working Directory inside the container
COPY . .
# Run the build and install
RUN go install -tags=openssl -v ./...
# Create single-layer run image
FROM alpine
COPY --from=build /go/bin/hydra-booster /hydra-booster
RUN apk add --no-cache openssl
# HTTP API
EXPOSE 7779
# Prometheus /metrics
EXPOSE 8888
# Heads
EXPOSE 30000-32767
EXPOSE 30000-32767/udp
CMD ["./hydra-booster", "-metrics-addr=0.0.0.0:8888", "-httpapi-addr=0.0.0.0:7779", "-ui-theme=none"]