Files
TMCandClaude Opus 5.5 9d6a921c34
CI / build (push) Successful in 30s
Start HODA: a homelab dashboard built from Docker labels
Apps opt in with sema.dashboard.* labels in their own compose file. The
primary reads its host's containers through a read-only socket proxy,
follows Docker events, and merges in what the agent on the second host
reports. Icons come from the icon label, the dashboard-icons set or the
app's favicon, with a letter as the fallback.

Go with only the standard library, a distroless image, and a Gitea
Actions workflow copied from FiMa's: checks in the Dockerfile's check
stage, a Trivy scan, and a push to git.mariosem.es/msemes/hoda.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 21:18:20 +01:00

42 lines
1.6 KiB
Docker

# syntax=docker/dockerfile:1.7
# HODA image, built from the repository root.
#
# docker build -t hoda . # production image (default target)
# docker build --target check . # CI: gofmt, go vet, go test
ARG GO_VERSION=1
FROM golang:${GO_VERSION}-alpine AS source
WORKDIR /src
# HODA uses only the standard library; go.sum appears once a dependency does.
COPY go.mod go.sum* ./
RUN --mount=type=cache,target=/go/pkg/mod go mod download
COPY . .
# CI checks: the build fails when formatting, vet or a test fails.
FROM source AS check
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build \
test -z "$(gofmt -l .)" || { echo "Run gofmt on:"; gofmt -l .; exit 1; } \
&& go vet ./... \
&& go test ./...
FROM source AS build
ARG HODA_VERSION=dev
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -trimpath -ldflags="-s -w -X main.version=${HODA_VERSION}" -o /out/hoda ./cmd/hoda \
&& mkdir /out/data
FROM gcr.io/distroless/static:nonroot AS runner
ARG HODA_VERSION=dev
COPY --from=build /out/hoda /hoda
COPY --from=build --chown=65532:65532 /out/data /data
ENV DATA_DIR=/data
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 CMD ["/hoda", "healthcheck"]
LABEL org.opencontainers.image.title="HODA" \
org.opencontainers.image.description="Homelab dashboard built from Docker labels" \
org.opencontainers.image.source="https://git.mariosem.es/msemes/HODA" \
org.opencontainers.image.version="${HODA_VERSION}"
ENTRYPOINT ["/hoda"]