# Dockerfile for MEV Bot # Build stage FROM golang:1.25-alpine AS builder # Install build dependencies for CGO-enabled packages such as sqlite3 RUN apk add --no-cache git build-base # Set working directory WORKDIR /app # Ensure Go uses vendored dependencies inside the container ENV GOFLAGS=-mod=vendor ENV GOCACHE=/go/cache # Copy source code COPY . . # Build the application ENV CGO_ENABLED=1 RUN go build -o bin/mev-bot cmd/mev-bot/main.go # Final stage FROM alpine:latest # Install ca-certificates for HTTPS requests RUN apk --no-cache add ca-certificates # Create a non-root user RUN adduser -D -s /bin/sh mevbot # Set working directory WORKDIR /app # Copy the binary from builder stage COPY --from=builder /app/bin/mev-bot . # Copy config files COPY --from=builder /app/config ./config # Change ownership to non-root user RUN chown -R mevbot:mevbot . # Switch to non-root user USER mevbot # Expose port (if needed for any web interfaces) EXPOSE 8080 # Command to run the application ENTRYPOINT ["./mev-bot"] CMD ["start"]