FROM node:20-slim

WORKDIR /app

COPY package.json package-lock.json ./
RUN npm ci --production

COPY tsconfig.json ./
COPY agents/ ./agents/

# Output and briefs directories
RUN mkdir -p agents/social-listening/outputs agents/social-listening/briefs

# Run as node user (uid 1000) — host volume dirs must be writable by uid 1000
USER node

EXPOSE 3456

# Default: run the dashboard
CMD ["npx", "tsx", "agents/social-listening/dashboard/server.ts"]
