54 lines
1013 B
Docker
54 lines
1013 B
Docker
# Dockerfile for MEV Bot
|
|
|
|
# Build stage
|
|
FROM golang:1.24-alpine AS builder
|
|
|
|
# Install git (needed for go mod download with private repos)
|
|
RUN apk add --no-cache git
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy go mod and sum files
|
|
COPY go.mod go.sum ./
|
|
|
|
# Download dependencies
|
|
RUN go mod download
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the application
|
|
ENV CGO_ENABLED=0
|
|
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"] |