2025-12-29 19:49:33 +00:00
|
|
|
# Dockerfile for testing P2P node functionality
|
|
|
|
|
# Build: docker build -f Dockerfile.node -t mining-node .
|
|
|
|
|
# Run: docker run -it --name node1 mining-node node serve
|
|
|
|
|
# docker run -it --name node2 mining-node node serve
|
|
|
|
|
|
2025-12-29 22:10:45 +00:00
|
|
|
FROM golang:1.24-alpine AS builder
|
2025-12-29 19:49:33 +00:00
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# Install build dependencies
|
|
|
|
|
RUN apk add --no-cache git
|
|
|
|
|
|
|
|
|
|
# Copy go mod files first for caching
|
|
|
|
|
COPY go.mod go.sum ./
|
2025-12-29 22:10:45 +00:00
|
|
|
ENV GOTOOLCHAIN=auto
|
2025-12-29 19:49:33 +00:00
|
|
|
RUN go mod download
|
|
|
|
|
|
|
|
|
|
# Copy source code
|
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
|
|
# Build the CLI
|
2025-12-30 19:43:02 +00:00
|
|
|
RUN CGO_ENABLED=0 go build -o miner-ctrl ./cmd/mining
|
2025-12-29 19:49:33 +00:00
|
|
|
|
|
|
|
|
# Runtime image
|
|
|
|
|
FROM alpine:3.19
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# Install runtime dependencies
|
|
|
|
|
RUN apk add --no-cache ca-certificates
|
|
|
|
|
|
|
|
|
|
# Copy the binary
|
2025-12-30 19:43:02 +00:00
|
|
|
COPY --from=builder /app/miner-ctrl /usr/local/bin/miner-ctrl
|
2025-12-29 19:49:33 +00:00
|
|
|
|
|
|
|
|
# Create config directories
|
|
|
|
|
RUN mkdir -p /root/.config/lethean-desktop /root/.local/share/lethean-desktop
|
|
|
|
|
|
|
|
|
|
# Expose the P2P port
|
|
|
|
|
EXPOSE 9091
|
|
|
|
|
|
|
|
|
|
# Default command shows help
|
2025-12-30 19:43:02 +00:00
|
|
|
ENTRYPOINT ["miner-ctrl"]
|
2025-12-29 19:49:33 +00:00
|
|
|
CMD ["--help"]
|