-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
57 lines (41 loc) · 1.93 KB
/
Copy pathDockerfile
File metadata and controls
57 lines (41 loc) · 1.93 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
48
49
50
51
52
53
54
55
56
57
# ──────────────────────────────────────────────────────────────
# AOS Backend — builds from repo root so agent-swarm/ is included
# ──────────────────────────────────────────────────────────────
# Stage 1: dependency cache layer
FROM python:3.12-slim-bookworm AS deps
WORKDIR /deps
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential gcc libpq-dev curl \
&& rm -rf /var/lib/apt/lists/*
COPY backend/requirements.txt backend-requirements.txt
COPY agent-swarm/requirements-runtime.txt swarm-requirements.txt
RUN pip install --no-cache-dir -r backend-requirements.txt \
&& pip install --no-cache-dir -r swarm-requirements.txt
# Stage 2: production image
FROM python:3.12-slim-bookworm AS production
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONPATH=/app/agent-swarm
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq-dev curl \
&& rm -rf /var/lib/apt/lists/*
# Copy installed packages from deps stage
COPY --from=deps /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=deps /usr/local/bin /usr/local/bin
# Copy source — backend and swarm runtime
COPY backend/ backend/
COPY agent-swarm/ agent-swarm/
# Collect static files
WORKDIR /app/backend
RUN python manage.py collectstatic --noinput --settings=backend.settings || true
RUN chmod +x /app/backend/docker-entrypoint.sh
EXPOSE 8000
ENTRYPOINT ["/app/backend/docker-entrypoint.sh"]
CMD ["gunicorn", "backend.wsgi:application", \
"--workers", "4", \
"--worker-class", "sync", \
"--bind", "0.0.0.0:8000", \
"--access-logfile", "-", \
"--error-logfile", "-", \
"--timeout", "120"]