Files
harmony/harmony_agent/Dockerfile

45 lines
1.2 KiB
Docker

# Build stage
FROM rust:slim AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y pkg-config && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy all required packages
COPY . .
RUN ls -la1
# Build the application in release mode
RUN cargo build --release -p harmony_agent
# Runtime stage
FROM debian:bookworm-slim
# Install runtime dependencies
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy the binary from the builder stage
COPY --from=builder /app/target/release/harmony_agent ./harmony_agent
# Declare environment variables used by the Harmony Agent
# These will be set from build-time environment variables if present
# NATS_URL: URL of the NATS server (default: nats://localhost:4222)
ARG NATS_URL=nats://localhost:4222
ENV NATS_URL=${NATS_URL}
# NATS_CREDS_PATH: Optional path to NATS credentials file
ARG NATS_CREDS_PATH
ENV NATS_CREDS_PATH=${NATS_CREDS_PATH}
# MY_CLUSTER_ID: This cluster's unique identifier (required)
ARG MY_CLUSTER_ID
ENV MY_CLUSTER_ID=${MY_CLUSTER_ID}
# DESIRED_PRIMARY: The ID of the desired primary cluster (required)
ARG DESIRED_PRIMARY
ENV DESIRED_PRIMARY=${DESIRED_PRIMARY}
# Run the application
ENTRYPOINT ["./harmony_agent"]