Dockerfile.seaweedfs 871 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. FROM golang:1.24-alpine AS builder
  2. # Install git and other build dependencies
  3. RUN apk add --no-cache git make
  4. # Set working directory
  5. WORKDIR /app
  6. # Copy go mod files first for better caching
  7. COPY go.mod go.sum ./
  8. RUN go mod download
  9. # Copy source code
  10. COPY . .
  11. # Build the weed binary without CGO
  12. RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -o weed ./weed/
  13. # Final stage - minimal runtime image
  14. FROM alpine:latest
  15. # Install ca-certificates for HTTPS calls and netcat for health checks
  16. RUN apk --no-cache add ca-certificates netcat-openbsd curl
  17. WORKDIR /root/
  18. # Copy the weed binary from builder stage
  19. COPY --from=builder /app/weed .
  20. # Make it executable
  21. RUN chmod +x ./weed
  22. # Expose ports
  23. EXPOSE 9333 8888 8333 8085 9533 5432
  24. # Create data directory
  25. RUN mkdir -p /data
  26. # Default command (can be overridden)
  27. CMD ["./weed", "server", "-dir=/data"]