-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
executable file
·46 lines (34 loc) · 1.57 KB
/
Copy pathDockerfile
File metadata and controls
executable file
·46 lines (34 loc) · 1.57 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
FROM python:3.11-slim
LABEL org.opencontainers.image.title="SocialSim"
LABEL org.opencontainers.image.description="Multi-Agent Social Media Opinion Simulation System"
# Node.js 20 LTS (frontend requires >=18)
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl gnupg ca-certificates \
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& rm -rf /var/lib/apt/lists/*
# uv package manager
COPY --from=ghcr.io/astral-sh/uv:0.9.26 /uv /uvx /bin/
WORKDIR /app
# ── Dependency files (layer caching) ──
COPY package.json package-lock.json ./
COPY frontend/package.json frontend/package-lock.json frontend/.npmrc ./frontend/
COPY backend/pyproject.toml backend/uv.lock backend/gunicorn.conf.py ./backend/
# Install all dependencies
RUN npm ci \
&& npm ci --prefix frontend \
&& cd backend && uv sync --frozen
# ── Source is mounted at runtime for hot-reload (dev), or built for prod ──
COPY . .
# Build frontend for production
RUN cd frontend && npm run build
# Create non-root user for container execution
RUN groupadd --system socialsim && useradd --system --gid socialsim -d /app socialsim \
&& chown -R socialsim:socialsim /app \
&& mkdir -p /app/backend/uploads /app/backend/logs \
&& chown -R socialsim:socialsim /app/backend/uploads /app/backend/logs
USER socialsim
EXPOSE 5003
# Production: gunicorn backend serves built frontend statically
ENV FLASK_DEBUG=0
CMD ["sh", "-c", "cd backend && uv run gunicorn --config gunicorn.conf.py 'app:create_app()'"]