From d6d53205af50b72d7aa9cfea556546848d5de10f Mon Sep 17 00:00:00 2001 From: Gemini Agent Date: Sat, 29 Nov 2025 12:30:40 -0600 Subject: [PATCH] feat(docker): add containerization for production deployment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added Dockerfile with multi-stage build (Go 1.25rc1-alpine) - Added docker-compose.yml for easy deployment - Added .dockerignore for efficient builds - Bot now runs in Podman/Docker container as intended 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .dockerignore | 50 ++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 38 +++++++++++++++++++++++++++++++++++ docker-compose.yml | 28 ++++++++++++++++++++++++++ 3 files changed, 116 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..1e9c60a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,50 @@ +# Binaries +bin/ +*.exe +*.dll +*.so +*.dylib + +# Test files +*.test +coverage.out +coverage.html + +# IDE +.vscode/ +.idea/ +*.swp +*.swo + +# Git +.git/ +.gitignore + +# Docker +Dockerfile +docker-compose.yml +.dockerignore + +# Logs +logs/ +*.log + +# Cache +.gocache/ +.gomodcache/ + +# Docs +docs/ +CLAUDE.md +README*.md +PRODUCTION_READY.md +*.md + +# Original V1 +orig/ + +# Scripts (not needed in container) +scripts/ + +# Contracts (not needed in runtime) +contracts/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ae2a97e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +# MEV Flash Loan Bot - Production Dockerfile +FROM golang:1.25rc1-alpine AS builder + +# Install build dependencies +RUN apk add --no-cache git gcc musl-dev + +WORKDIR /build + +# Copy go mod files +COPY go.mod go.sum ./ +RUN go mod download + +# Copy source code +COPY . . + +# Build the application +RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o mev-flashloan cmd/mev-flashloan/main.go + +# Final stage - minimal runtime image +FROM alpine:latest + +RUN apk --no-cache add ca-certificates + +WORKDIR /app + +# Copy binary from builder +COPY --from=builder /build/mev-flashloan . + +# Create non-root user +RUN addgroup -S mevbot && adduser -S mevbot -G mevbot +USER mevbot + +# Expose metrics port (optional) +EXPOSE 9090 + +# Run the bot +ENTRYPOINT ["./mev-flashloan"] +CMD ["--min-profit", "10"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..141545b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,28 @@ +version: '3.8' + +services: + mev-bot: + build: + context: . + dockerfile: Dockerfile + image: mev-flashloan:latest + container_name: mev-flashloan-bot + restart: unless-stopped + environment: + - ARBITRUM_RPC_URL=${ARBITRUM_RPC_URL:-https://arb1.arbitrum.io/rpc} + - PRIVATE_KEY=${PRIVATE_KEY} + - MIN_PROFIT_BPS=${MIN_PROFIT_BPS:-10} + - SCAN_INTERVAL=${SCAN_INTERVAL:-30s} + - MAX_GAS_PRICE=${MAX_GAS_PRICE:-1000000000} + command: ["--min-profit", "${MIN_PROFIT_BPS:-10}", "--interval", "${SCAN_INTERVAL:-30s}"] + networks: + - mev-network + logging: + driver: "json-file" + options: + max-size: "10m" + max-file: "3" + +networks: + mev-network: + driver: bridge