Files
next.orly.dev/cmd/benchmark/Dockerfile.next-orly
mleku 110223fc4e Migrate internal module imports to unified package path.
Replaced legacy `*.orly` module imports with `next.orly.dev/pkg` paths across the codebase for consistency. Removed legacy `go.mod` files from sub-packages, consolidating dependency management. Added Dockerfiles and configurations for benchmarking environments.
2025-09-12 16:12:31 +01:00

80 lines
1.9 KiB
Docker

# Dockerfile for next.orly.dev relay
FROM ubuntu:22.04 as builder
# Set environment variables
ARG GOLANG_VERSION=1.25.1
# Update package list and install dependencies
RUN apt-get update && \
apt-get install -y wget ca-certificates && \
rm -rf /var/lib/apt/lists/*
# Download Go binary
RUN wget https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz && \
rm -rf /usr/local/go && \
tar -C /usr/local -xzf go${GOLANG_VERSION}.linux-amd64.tar.gz && \
rm go${GOLANG_VERSION}.linux-amd64.tar.gz
# Set PATH environment variable
ENV PATH="/usr/local/go/bin:${PATH}"
# Verify installation
RUN go version
RUN apt update && \
apt -y install build-essential autoconf libtool git wget
RUN cd /tmp && \
rm -rf secp256k1 && \
git clone https://github.com/bitcoin-core/secp256k1.git && \
cd secp256k1 && \
git checkout v0.6.0 && \
git submodule init && \
git submodule update && \
./autogen.sh && \
./configure --enable-module-schnorrsig --enable-module-ecdh --prefix=/usr && \
make -j1 && \
make install
# Set working directory
WORKDIR /build
# Copy go modules
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build the relay
RUN CGO_ENABLED=1 GOOS=linux go build -o relay .
# Final stage
FROM ubuntu:22.04
# Install runtime dependencies
RUN apt-get update && apt-get install -y ca-certificates curl libsecp256k1-0 libsecp256k1-dev && rm -rf /var/lib/apt/lists/* && \
ln -sf /usr/lib/x86_64-linux-gnu/libsecp256k1.so.0 /usr/lib/x86_64-linux-gnu/libsecp256k1.so.5
WORKDIR /app
# Copy binary from builder
COPY --from=builder /build/relay /app/relay
# Create data directory
RUN mkdir -p /data
# Expose port
EXPOSE 8080
# Set environment variables
ENV DATA_DIR=/data
ENV LISTEN=0.0.0.0
ENV PORT=8080
ENV LOG_LEVEL=info
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8080 || exit 1
# Run the relay
CMD ["/app/relay"]