-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathDockerfile
43 lines (34 loc) · 1.09 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
41
42
43
FROM golang:1.23 AS builder
WORKDIR /hostd
# get dependencies
COPY go.mod go.sum ./
RUN go mod download
# copy source
COPY . .
# codegen
RUN go generate ./...
# build
RUN CGO_ENABLED=1 go build -o bin/ -tags='netgo timetzdata' -trimpath -a -ldflags '-s -w -linkmode external -extldflags "-static"' ./cmd/hostd
FROM debian:bookworm-slim
LABEL maintainer="The Sia Foundation <[email protected]>" \
org.opencontainers.image.description.vendor="The Sia Foundation" \
org.opencontainers.image.description="A hostd container - provide storage on the Sia network and earn Siacoin" \
org.opencontainers.image.source="https://github.com/SiaFoundation/hostd" \
org.opencontainers.image.licenses=MIT
# copy binary and certificates
COPY --from=builder /hostd/bin/* /usr/bin/
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ENV HOSTD_DATA_DIR=/data
ENV HOSTD_CONFIG_FILE=/data/hostd.yml
VOLUME [ "/data" ]
# API port
EXPOSE 9980/tcp
# RPC port
EXPOSE 9981/tcp
# RHP2 port
EXPOSE 9982/tcp
# RHP3 TCP port
EXPOSE 9983/tcp
# RHP4 TCP port
EXPOSE 9984/tcp
ENTRYPOINT [ "hostd", "--env", "--http", ":9980" ]