Dockerfile.rely-sqlite raw

   1  # Dockerfile for rely-sqlite relay
   2  FROM golang:1.25-alpine AS builder
   3  
   4  # Install build dependencies
   5  RUN apk add --no-cache git gcc musl-dev sqlite-dev
   6  
   7  WORKDIR /build
   8  
   9  # Clone rely-sqlite repository
  10  RUN git clone https://github.com/pippellia-btc/rely-sqlite.git .
  11  
  12  # Copy our custom main.go that uses environment variables for configuration
  13  # Remove build tags (first 3 lines) since we want this file to be compiled here
  14  COPY rely-sqlite-main.go ./rely-sqlite-main.go
  15  RUN sed '1,3d' ./rely-sqlite-main.go > ./main.go.new && \
  16      mv -f ./main.go.new ./main.go && \
  17      rm -f ./rely-sqlite-main.go
  18  
  19  # Download dependencies
  20  RUN go mod download
  21  
  22  # Build the relay with CGO enabled (required for SQLite)
  23  RUN CGO_ENABLED=1 go build -o relay .
  24  
  25  # Final stage
  26  FROM alpine:latest
  27  
  28  # Install runtime dependencies (curl for health check)
  29  RUN apk --no-cache add ca-certificates sqlite-libs curl
  30  
  31  WORKDIR /app
  32  
  33  # Copy binary from builder
  34  COPY --from=builder /build/relay /app/relay
  35  
  36  # Create data directory
  37  RUN mkdir -p /data && chmod 777 /data
  38  
  39  # Expose port (rely default is 3334)
  40  EXPOSE 3334
  41  
  42  # Environment variables
  43  ENV DATABASE_PATH=/data/relay.db
  44  ENV RELAY_LISTEN=0.0.0.0:3334
  45  
  46  # Run the relay
  47  CMD ["/app/relay"]
  48