58 lines
1.6 KiB
Docker
58 lines
1.6 KiB
Docker
# DCOS — Single-stage Docker image (mirrors stonks-oracle pipeline pattern)
|
|
# Production backends: Redis (working, conversation, user_model, world_model, procedural)
|
|
# SQLite fallback: long_term, semantic, episodic
|
|
|
|
FROM python:3.12-slim
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV PYTHONPATH=/app
|
|
|
|
# Install async database drivers (asyncpg needs libpq-dev)
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
gcc \
|
|
libpq-dev \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy DCOS source into container (dcos package at /app/dcos/)
|
|
COPY src/dcos/ /app/dcos/
|
|
COPY config/ /app/config/
|
|
COPY data/ /app/data/
|
|
|
|
# Install dependencies (PyYAML for config, async database drivers)
|
|
RUN pip install --no-cache-dir \
|
|
"pyyaml>=6.0" \
|
|
"asyncpg==0.29.0" \
|
|
"redis>=5.0" \
|
|
"aiosqlite>=0.20" \
|
|
--break-system-packages
|
|
|
|
EXPOSE 8080
|
|
|
|
# Set environment defaults (overridden by K8s manifests at runtime)
|
|
ENV DCOS_DATA_DIR=/app/data/memory_store
|
|
ENV DCOS_CONFIG_DIR=/app/config
|
|
ENV DCOS_LOG_LEVEL=INFO
|
|
ENV DCOS_PG_HOST=postgresql-rw.postgresql-service.svc.cluster.local
|
|
ENV DCOS_PG_PORT=5432
|
|
ENV DCOS_PG_USER=celes
|
|
ENV DCOS_PG_DB=dcos
|
|
ENV DCOS_REDIS_HOST=redis-master
|
|
ENV DCOS_REDIS_PORT=6379
|
|
|
|
# Create non-root user (matches stonks-oracle pipeline convention) — must come before chown
|
|
RUN useradd -m -u 1000 stonks && \
|
|
mkdir -p /app/data/memory_store && \
|
|
chown -R stonks:stonks /app
|
|
|
|
USER stonks
|
|
|
|
# SERVICE_CMD ARG — same pattern as stonks-oracle's docker/Dockerfile
|
|
ARG SERVICE_CMD="python -m dcos.core --init"
|
|
ENV SERVICE_CMD=${SERVICE_CMD}
|
|
|
|
CMD ["sh", "-c", "${SERVICE_CMD}"]
|