scaffolding
Authored by
mfwolffe <wolffemf@dukes.jmu.edu>
- SHA
050dfd3cbb6a5fd7a363150cfac9f51dec12fa98- Tree
dd5b860
050dfd3
050dfd3cbb6a5fd7a363150cfac9f51dec12fa98dd5b860| Status | File | + | - |
|---|---|---|---|
| A |
.gitignore
|
1 | 0 |
| A |
Dockerfile
|
46 | 0 |
| A |
go.mod
|
41 | 0 |
.gitignoreadded@@ -0,0 +1,1 @@ | ||
| 1 | +.github/ | |
Dockerfileadded@@ -0,0 +1,46 @@ | ||
| 1 | +# Multi-stage build for ZephyrFS Coordinator | |
| 2 | +FROM golang:1.21-alpine AS builder | |
| 3 | + | |
| 4 | +# Install build dependencies | |
| 5 | +RUN apk add --no-cache git ca-certificates | |
| 6 | + | |
| 7 | +WORKDIR /app | |
| 8 | + | |
| 9 | +# Copy go mod files | |
| 10 | +COPY go.mod go.sum ./ | |
| 11 | +RUN go mod download | |
| 12 | + | |
| 13 | +# Copy source code | |
| 14 | +COPY . . | |
| 15 | + | |
| 16 | +# Build the binary | |
| 17 | +RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o coordinator ./cmd/coordinator/ | |
| 18 | + | |
| 19 | +# Final runtime image | |
| 20 | +FROM alpine:3.19 | |
| 21 | + | |
| 22 | +# Install ca-certificates for TLS | |
| 23 | +RUN apk --no-cache add ca-certificates | |
| 24 | + | |
| 25 | +WORKDIR /root/ | |
| 26 | + | |
| 27 | +# Create non-root user | |
| 28 | +RUN addgroup -g 1000 zephyr && adduser -D -s /bin/sh -u 1000 -G zephyr zephyr | |
| 29 | + | |
| 30 | +# Create data directory | |
| 31 | +RUN mkdir -p /var/lib/zephyrfs && chown zephyr:zephyr /var/lib/zephyrfs | |
| 32 | + | |
| 33 | +# Copy binary from builder stage | |
| 34 | +COPY --from=builder /app/coordinator . | |
| 35 | +COPY --from=builder /app/configs/config.yaml ./config.yaml | |
| 36 | + | |
| 37 | +USER zephyr | |
| 38 | + | |
| 39 | +# Expose coordinator API port | |
| 40 | +EXPOSE 9090 | |
| 41 | + | |
| 42 | +# Health check | |
| 43 | +HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ | |
| 44 | + CMD ./coordinator --health-check || exit 1 | |
| 45 | + | |
| 46 | +ENTRYPOINT ["./coordinator"] | |
go.modadded@@ -0,0 +1,41 @@ | ||
| 1 | +module github.com/ZephyrFS/zephyrfs-coordinator | |
| 2 | + | |
| 3 | +go 1.21 | |
| 4 | + | |
| 5 | +require ( | |
| 6 | + github.com/gin-gonic/gin v1.10.0 | |
| 7 | + github.com/libp2p/go-libp2p v0.36.0 | |
| 8 | + go.etcd.io/bbolt v1.3.10 | |
| 9 | + google.golang.org/grpc v1.65.0 | |
| 10 | + google.golang.org/protobuf v1.34.2 | |
| 11 | + github.com/sirupsen/logrus v1.9.3 | |
| 12 | + gopkg.in/yaml.v3 v3.0.1 | |
| 13 | +) | |
| 14 | + | |
| 15 | +require ( | |
| 16 | + github.com/bytedance/sonic v1.11.6 // indirect | |
| 17 | + github.com/bytedance/sonic/loader v0.1.1 // indirect | |
| 18 | + github.com/cloudwego/base64x v0.1.4 // indirect | |
| 19 | + github.com/cloudwego/iasm v0.2.0 // indirect | |
| 20 | + github.com/gabriel-vasile/mimetype v1.4.3 // indirect | |
| 21 | + github.com/gin-contrib/sse v0.1.0 // indirect | |
| 22 | + github.com/go-playground/locales v0.14.1 // indirect | |
| 23 | + github.com/go-playground/universal-translator v0.18.1 // indirect | |
| 24 | + github.com/go-playground/validator/v10 v10.20.0 // indirect | |
| 25 | + github.com/goccy/go-json v0.10.2 // indirect | |
| 26 | + github.com/json-iterator/go v1.1.12 // indirect | |
| 27 | + github.com/klauspost/cpuid/v2 v2.2.7 // indirect | |
| 28 | + github.com/leodido/go-urn v1.4.0 // indirect | |
| 29 | + github.com/mattn/go-isatty v0.0.20 // indirect | |
| 30 | + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | |
| 31 | + github.com/modern-go/reflect2 v1.0.2 // indirect | |
| 32 | + github.com/pelletier/go-toml/v2 v2.2.2 // indirect | |
| 33 | + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect | |
| 34 | + github.com/ugorji/go/codec v1.2.12 // indirect | |
| 35 | + golang.org/x/arch v0.8.0 // indirect | |
| 36 | + golang.org/x/crypto v0.23.0 // indirect | |
| 37 | + golang.org/x/net v0.25.0 // indirect | |
| 38 | + golang.org/x/sys v0.20.0 // indirect | |
| 39 | + golang.org/x/text v0.15.0 // indirect | |
| 40 | + google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect | |
| 41 | +) | |