Skip to content

Commit f368cce

Browse files
authored
Merge pull request #566 from SiaFoundation/nate/docker-base-image
Switch Docker base from scratch to debian:slim
2 parents 49c373f + 449c29c commit f368cce

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
default: major
3+
---
4+
5+
# Switched Docker base image from scratch to debian:bookworm-slim

Dockerfile

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM docker.io/library/golang:1.23 AS builder
1+
FROM golang:1.23 AS builder
22

33
WORKDIR /hostd
44

@@ -11,29 +11,24 @@ COPY . .
1111
# codegen
1212
RUN go generate ./...
1313
# build
14-
RUN CGO_ENABLED=1 go build -o bin/ -tags='netgo timetzdata' -trimpath -a -ldflags '-s -w -linkmode external -extldflags "-static"' ./cmd/hostd
14+
RUN CGO_ENABLED=1 go build -o bin/ -tags='timetzdata' -trimpath -a -ldflags '-s -w -linkmode external -extldflags "-static"' ./cmd/hostd
1515

16-
FROM scratch
16+
FROM debian:bookworm-slim
1717

1818
LABEL maintainer="The Sia Foundation <info@sia.tech>" \
19-
org.opencontainers.image.description.vendor="The Sia Foundation" \
20-
org.opencontainers.image.description="A hostd container - provide storage on the Sia network and earn Siacoin" \
21-
org.opencontainers.image.source="https://github.com/SiaFoundation/hostd" \
22-
org.opencontainers.image.licenses=MIT
19+
org.opencontainers.image.description.vendor="The Sia Foundation" \
20+
org.opencontainers.image.description="A hostd container - provide storage on the Sia network and earn Siacoin" \
21+
org.opencontainers.image.source="https://github.com/SiaFoundation/hostd" \
22+
org.opencontainers.image.licenses=MIT
2323

24-
ENV PUID=0
25-
ENV PGID=0
24+
# copy binary and certificates
25+
COPY --from=builder /hostd/bin/* /usr/bin/
26+
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
2627

27-
ENV HOSTD_API_PASSWORD=
28-
ENV HOSTD_WALLET_SEED=
2928
ENV HOSTD_DATA_DIR=/data
3029
ENV HOSTD_CONFIG_FILE=/data/hostd.yml
3130

32-
# copy binary and prepare data dir.
33-
COPY --from=builder /hostd/bin/* /usr/bin/
34-
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
3531
VOLUME [ "/data" ]
36-
3732
# API port
3833
EXPOSE 9980/tcp
3934
# RPC port
@@ -42,7 +37,7 @@ EXPOSE 9981/tcp
4237
EXPOSE 9982/tcp
4338
# RHP3 TCP port
4439
EXPOSE 9983/tcp
45-
46-
USER ${PUID}:${PGID}
40+
# RHP4 TCP port
41+
EXPOSE 9984/tcp
4742

4843
ENTRYPOINT [ "hostd", "--env", "--http", ":9980" ]

cmd/hostd/run.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ func defaultDataDirectory(fp string) string {
5050

5151
// check for databases in the current directory
5252
if _, err := os.Stat("hostd.db"); err == nil {
53-
return ""
53+
return "."
5454
} else if _, err := os.Stat("hostd.sqlite3"); err == nil {
55-
return ""
55+
return "."
5656
}
5757

5858
// default to the operating system's application directory
@@ -64,7 +64,7 @@ func defaultDataDirectory(fp string) string {
6464
case "linux", "freebsd", "openbsd":
6565
return filepath.Join(string(filepath.Separator), "var", "lib", "hostd")
6666
default:
67-
return ""
67+
return "."
6868
}
6969
}
7070

0 commit comments

Comments
 (0)