anya-core 1.2.0

Enterprise-grade Bitcoin Infrastructure Platform
Documentation
# Multi-stage Docker build for optimized and secure container
# Version: 0.3.0-rc.2 (Source: Cargo.toml line 4)
# Port: 8080 (Source: src/main.rs line 36)
# Binary: anya (Source: Cargo.toml [[bin]] section)

FROM rust:1.70-alpine AS builder

# Install build dependencies (no PostgreSQL for decentralized architecture)
RUN apk add --no-cache \
    musl-dev \
    openssl-dev \
    pkgconfig

WORKDIR /build

# Copy dependency files first for better caching
COPY Cargo.toml Cargo.lock ./

# Create dummy source to cache dependencies
RUN mkdir -p src && \
    echo "fn main() {}" > src/main.rs

# Build dependencies (cached layer)
RUN cargo build --release

# Copy actual source code
COPY . .

# Build the actual application
RUN touch src/main.rs && \
    cargo build --release

# Runtime stage - minimal Alpine image
FROM alpine:3.18

# Install runtime dependencies (no PostgreSQL for decentralized operation)
RUN apk add --no-cache \
    ca-certificates \
    libssl3 \
    libcrypto3 \
    curl && \
    rm -rf /var/cache/apk/*

# Create non-root user
RUN addgroup -g 1000 anya && \
    adduser -D -s /bin/sh -u 1000 -G anya anya && \
    mkdir -p /app/data /app/logs && \
    chown -R anya:anya /app

# Copy binary from builder stage
COPY --from=builder /build/target/release/anya /usr/local/bin/anya
RUN chmod +x /usr/local/bin/anya

# Copy configuration files if they exist
COPY --chown=anya:anya config/ /app/config/ 2>/dev/null || true

# Switch to non-root user
USER anya
WORKDIR /app

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
    CMD curl -f http://localhost:8080/health || exit 1

# Security labels with verified version
LABEL maintainer="Anya Core Team" \
      version="0.3.0-rc.2" \
      description="Anya Decentralized Core Node - Secure" \
      security.scan="enabled" \
      architecture="decentralized" \
      port="8080"

# Expose port
EXPOSE 8080

# Set secure environment defaults for decentralized operation
ENV RUST_LOG=info \
    RUST_BACKTRACE=1 \
    ANYA_MODE=decentralized \
    ANYA_DATA_DIR=/app/data \
    ANYA_LOG_DIR=/app/logs

# Run the application
CMD ["anya"]