diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5adb4f9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,62 @@ +# Multi-stage build for Claude Persistent Agent Container +FROM python:3.11-slim as base + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + curl \ + git \ + build-essential \ + postgresql-client \ + sqlite3 \ + supervisor \ + nodejs \ + npm \ + && rm -rf /var/lib/apt/lists/* + +# Install Claude Code +RUN npm install -g @anthropic-ai/claude-code + +WORKDIR /app + +# Copy backend requirements +COPY backend/requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +# Copy backend code +COPY backend/ ./backend/ + +# Build frontend +FROM node:18-slim as frontend-builder +WORKDIR /app/frontend +COPY frontend/package*.json ./ +RUN npm ci +COPY frontend/ . +RUN npm run build + +# Final stage +FROM base +WORKDIR /app + +# Copy built frontend +COPY --from=frontend-builder /app/frontend/dist ./frontend/dist +COPY --from=frontend-builder /app/frontend/package*.json ./frontend/ + +# Create necessary directories +RUN mkdir -p /app/logs /app/data /app/tasks /root/.claude + +# Copy supervisor config +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf + +# Copy startup script +COPY docker-entrypoint.sh /app/ +RUN chmod +x /app/docker-entrypoint.sh + +# Expose ports +EXPOSE 3000 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ + CMD curl -f http://localhost:8000/health || exit 1 + +ENTRYPOINT ["/app/docker-entrypoint.sh"] +CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]