Docker Integration
Containerize Aphelion for Kubernetes and Docker Compose.
Prerequisite
You need a Pro License to download the binary during image build.
Custom Docker Image
Create a Dockerfile to build a lightweight image containing the Aphelion CLI.
FROM node:18-alpine
# Install dependencies (curl for download)
RUN apk add --no-cache curl
# Download Aphelion (pass key as build-arg)
ARG APHELION_LICENSE_KEY
RUN curl -L "https://algomimic.com/api/download/pro?key=${APHELION_LICENSE_KEY}" \
-o /usr/local/bin/aphelion && \
chmod +x /usr/local/bin/aphelion
# Create entrypoint script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
Entrypoint Script
#!/bin/sh
# entrypoint.sh
# Run Aphelion commands passed to docker run
exec aphelion "$@"
Build & Run
# Build
docker build --build-arg APHELION_LICENSE_KEY="pro:..." -t my-aphelion .
# Run (connect to host db)
docker run --network host my-aphelion clone \
postgresql://localhost/prod postgresql://localhost/test \
--auto-approve
Docker Compose
Orchestrate database seeding alongside your application services.
services:
app:
build: .
depends_on:
db:
condition: service_healthy
seeder:
condition: service_completed_successfully
db:
image: postgres:14
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
interval: 10s
timeout: 5s
retries: 5
seeder:
image: my-aphelion
depends_on:
db:
condition: service_healthy
command: >
clone "postgresql://prod-db/prod"
"postgresql://postgres@db/test_db"
--auto-approve
--seed 12345