1
0
Fork 0

Compare commits

...

2 commits

Author SHA1 Message Date
e9b5231cc8
fix: use proper addresses on dns nodes 2026-01-17 18:41:36 +03:00
cfd7ce9388
build: optimize docker build times 2026-01-17 18:41:16 +03:00
3 changed files with 10 additions and 8 deletions

View file

@ -1,17 +1,20 @@
FROM golang:alpine AS builder
WORKDIR /app
RUN apk --no-cache add make;
COPY go.mod .
COPY go.sum .
RUN go mod download;
COPY . .
RUN make hivemind;
ENV GOCACHE=/cache/go-build
RUN --mount=type=cache,target="/cache/go-build" mkdir -p /cache/go-build; make hivemind;
FROM alpine
EXPOSE 56714/tcp
WORKDIR /app
VOLUME /conf
@ -21,5 +24,4 @@ ENV HIVEMIND_CONFIG_FILE=/conf/config.toml
ENV HIVEMIND_REGISTRY_FILE=/data/registry.json
COPY --from=builder /app/build/hivemind .
CMD ["./hivemind"]

View file

@ -48,10 +48,10 @@ func parseState(state types.HostState) (string, []byte) {
var builder strings.Builder
for _, d := range state.Domains {
builder.WriteString(fmt.Sprintf("%s %s\n", state.Name, d))
builder.WriteString(fmt.Sprintf("%s %s\n", state.Endpoint, d))
}
return hostsDir + state.Endpoint, []byte(builder.String())
return hostsDir + state.Name, []byte(builder.String())
}
func (r *Role) OnStartup(ctx context.Context) error {

View file

@ -28,7 +28,7 @@ type Role struct {
func New(state *state.RuntimeState, config config.HostConfig) *Role {
return &Role{
client: newClient(config.Domain, config.IpAddress),
client: newClient(config.Domain, config.LocalAddress),
state: state,
config: config,
}
@ -87,7 +87,7 @@ func (r *Role) onCallback(w http.ResponseWriter, req *http.Request) {
func (r *Role) getInternal() (types.HostState, error) {
return types.HostState{
Domains: r.internalDomains,
Endpoint: r.state.Self.Address,
Endpoint: r.config.IpAddress,
Name: r.state.Self.Name,
}, nil
}