refactor(deploy): consolidate configuration and reorganize docker files

This commit is contained in:
zenhouke
2026-02-12 02:16:41 +08:00
parent 4de579b57b
commit 057e95cb9a
9 changed files with 64 additions and 89 deletions
+31
View File
@@ -0,0 +1,31 @@
FROM golang:1.25-alpine AS builder
WORKDIR /build
RUN apk add --no-cache git make
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -trimpath -ldflags "-s -w" \
-o memoh-server ./cmd/agent/main.go
FROM alpine:latest
WORKDIR /app
RUN apk add --no-cache ca-certificates tzdata wget
COPY --from=builder /build/memoh-server /app/memoh-server
RUN mkdir -p /var/lib/memoh/data
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1
CMD ["/app/memoh-server"]