Dockerfile.producer 722 B

1234567891011121314151617181920212223242526272829303132333435
  1. FROM golang:1.24-alpine AS builder
  2. # Set working directory
  3. WORKDIR /app
  4. # Copy go mod files first for better caching
  5. COPY go.mod go.sum ./
  6. RUN go mod download
  7. # Copy source code
  8. COPY . .
  9. # Build the producer
  10. RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o producer ./test/postgres/producer.go
  11. # Final stage
  12. FROM alpine:latest
  13. # Install ca-certificates for HTTPS calls
  14. RUN apk --no-cache add ca-certificates curl
  15. WORKDIR /root/
  16. # Copy the binary from builder stage
  17. COPY --from=builder /app/producer .
  18. # Make it executable
  19. RUN chmod +x ./producer
  20. # Set environment variables with defaults
  21. ENV SEAWEEDFS_MASTER=localhost:9333
  22. ENV SEAWEEDFS_FILER=localhost:8888
  23. # Run the producer
  24. CMD ["./producer"]