Compare commits
No commits in common. "e9b5231cc81511cf6327e5954826db4f33075a3f" and "24fcde5955cc13bd606a6c4e523598954913972d" have entirely different histories.
e9b5231cc8
...
24fcde5955
3 changed files with 8 additions and 10 deletions
10
Dockerfile
10
Dockerfile
|
|
@ -1,20 +1,17 @@
|
||||||
FROM golang:alpine AS builder
|
FROM golang:alpine AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN apk --no-cache add make;
|
RUN apk --no-cache add make;
|
||||||
|
|
||||||
COPY go.mod .
|
|
||||||
COPY go.sum .
|
|
||||||
|
|
||||||
RUN go mod download;
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
ENV GOCACHE=/cache/go-build
|
RUN make hivemind;
|
||||||
RUN --mount=type=cache,target="/cache/go-build" mkdir -p /cache/go-build; make hivemind;
|
|
||||||
|
|
||||||
FROM alpine
|
FROM alpine
|
||||||
|
|
||||||
EXPOSE 56714/tcp
|
EXPOSE 56714/tcp
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
VOLUME /conf
|
VOLUME /conf
|
||||||
|
|
@ -24,4 +21,5 @@ ENV HIVEMIND_CONFIG_FILE=/conf/config.toml
|
||||||
ENV HIVEMIND_REGISTRY_FILE=/data/registry.json
|
ENV HIVEMIND_REGISTRY_FILE=/data/registry.json
|
||||||
|
|
||||||
COPY --from=builder /app/build/hivemind .
|
COPY --from=builder /app/build/hivemind .
|
||||||
|
|
||||||
CMD ["./hivemind"]
|
CMD ["./hivemind"]
|
||||||
|
|
|
||||||
|
|
@ -48,10 +48,10 @@ func parseState(state types.HostState) (string, []byte) {
|
||||||
var builder strings.Builder
|
var builder strings.Builder
|
||||||
|
|
||||||
for _, d := range state.Domains {
|
for _, d := range state.Domains {
|
||||||
builder.WriteString(fmt.Sprintf("%s %s\n", state.Endpoint, d))
|
builder.WriteString(fmt.Sprintf("%s %s\n", state.Name, d))
|
||||||
}
|
}
|
||||||
|
|
||||||
return hostsDir + state.Name, []byte(builder.String())
|
return hostsDir + state.Endpoint, []byte(builder.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Role) OnStartup(ctx context.Context) error {
|
func (r *Role) OnStartup(ctx context.Context) error {
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ type Role struct {
|
||||||
|
|
||||||
func New(state *state.RuntimeState, config config.HostConfig) *Role {
|
func New(state *state.RuntimeState, config config.HostConfig) *Role {
|
||||||
return &Role{
|
return &Role{
|
||||||
client: newClient(config.Domain, config.LocalAddress),
|
client: newClient(config.Domain, config.IpAddress),
|
||||||
state: state,
|
state: state,
|
||||||
config: config,
|
config: config,
|
||||||
}
|
}
|
||||||
|
|
@ -87,7 +87,7 @@ func (r *Role) onCallback(w http.ResponseWriter, req *http.Request) {
|
||||||
func (r *Role) getInternal() (types.HostState, error) {
|
func (r *Role) getInternal() (types.HostState, error) {
|
||||||
return types.HostState{
|
return types.HostState{
|
||||||
Domains: r.internalDomains,
|
Domains: r.internalDomains,
|
||||||
Endpoint: r.config.IpAddress,
|
Endpoint: r.state.Self.Address,
|
||||||
Name: r.state.Self.Name,
|
Name: r.state.Self.Name,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue