-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (32 loc) · 1.45 KB
/
Dockerfile
File metadata and controls
47 lines (32 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# ── Build stage ───────────────────────────────────────────────────────────────
FROM python:3.12-slim AS builder
WORKDIR /app
# Install build deps only (not in final image)
RUN pip install --no-cache-dir hatchling
COPY pyproject.toml ./
COPY aim/ aim/
RUN pip install --no-cache-dir --prefix=/install .
# ── Runtime stage ─────────────────────────────────────────────────────────────
FROM python:3.12-slim AS runtime
LABEL maintainer="AIM Team"
LABEL description="AIM – Autonomous Institutional Memory"
# Security: run as non-root
RUN groupadd --gid 1000 aim && \
useradd --uid 1000 --gid aim --shell /bin/bash --create-home aim
WORKDIR /app
# Copy installed packages from builder
COPY --from=builder /install /usr/local
COPY aim/ aim/
# Ensure Python can find the package
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
WEB_CONCURRENCY=1
USER aim
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD python -c "from urllib.request import urlopen; urlopen('http://localhost:8000/health', timeout=4)"
ENTRYPOINT ["uvicorn", "aim.main:app", \
"--host", "0.0.0.0", \
"--port", "8000", \
"--workers", "1", \
"--log-config", "/dev/null"]