feat: add production build and health tooling

This commit is contained in:
OpenClaw Agent
2026-09-22 03:19:46 +08:00
parent de01ce2438
commit cd15e34961
8 changed files with 119 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
FROM golang:1.24-alpine AS build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG VERSION=dev
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags "-s -w -X main.version=${VERSION}" -o /out/chfs-ng ./cmd/chfs
FROM alpine:3.22
RUN apk add --no-cache ca-certificates tzdata
COPY --from=build /out/chfs-ng /usr/local/bin/chfs-ng
RUN mkdir -p /data && chmod 755 /data
VOLUME ["/data"]
EXPOSE 80
ENTRYPOINT ["/usr/local/bin/chfs-ng"]
CMD ["-path", "/data", "-port", "80"]
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 CMD wget -q -O - http://127.0.0.1/healthz >/dev/null || exit 1