Skip to content

A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.

feat: docker-compose.prod

dextmorgn715533f7dc38
diff --git a/Makefile b/Makefile
index 515be3d1..eee4c01d 100644
--- a/Makefile
+++ b/Makefile
@@ -12,6 +12,11 @@ dev:
$(MAKE) install
$(MAKE) run
+prod:
+ $(MAKE) check-env
+ docker compose -f docker-compose.prod.yml up -d
+ $(MAKE) frontend
+
check-env:
@echo "🔎 Checking .env files..."
@for dir in $(ENV_DIRS); do \
diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml
new file mode 100644
index 00000000..e9b5199a
--- /dev/null
+++ b/docker-compose.prod.yml
@@ -0,0 +1,80 @@
+name: flowsint
+services:
+ flowsint_api:
+ build:
+ context: ./flowsint-api
+ dockerfile: Dockerfile
+ target: prod
+ env_file: .env
+ ports:
+ - "5001:5001"
+ depends_on:
+ - postgres
+ - redis
+ - neo4j
+ celery:
+ build:
+ context: ./flowsint-core
+ dockerfile: Dockerfile
+ env_file: .env
+ depends_on:
+ - redis
+ - postgres
+ # PostgreSQL database
+ postgres:
+ image: postgres:15
+ container_name: flowsint-postgres
+ restart: always
+ environment:
+ POSTGRES_USER: flowsint
+ POSTGRES_PASSWORD: flowsint
+ POSTGRES_DB: flowsint
+ ports:
+ - "5433:5432" # 5433 sur l'hôte pour éviter conflit local
+ volumes:
+ - pg_data:/var/lib/postgresql/data
+ networks:
+ - flowsint_network
+
+ # Redis for Celery & cache
+ redis:
+ image: redis:alpine
+ container_name: redis-cache
+ ports:
+ - "6379:6379"
+ networks:
+ - flowsint_network
+
+ # Neo4j graph database
+ neo4j:
+ image: neo4j:5
+ container_name: flowsint-neo4j
+ ports:
+ - "7474:7474" # Web UI
+ - "7687:7687" # Bolt
+ environment:
+ - NEO4J_AUTH=${NEO4J_USERNAME}/${NEO4J_PASSWORD}
+ - NEO4J_PLUGINS=["apoc"]
+ - NEO4J_apoc_export_file_enabled=true
+ - NEO4J_apoc_import_file_enabled=true
+ - NEO4J_apoc_import_file_use__neo4j__config=true
+ volumes:
+ - neo4j_data:/data
+ - neo4j_logs:/logs
+ - neo4j_import:/var/lib/neo4j/import
+ - neo4j_plugins:/plugins
+ restart: unless-stopped
+ networks:
+ - flowsint_network
+
+networks:
+ flowsint_network:
+ name: flowsint_network
+ driver: bridge
+
+volumes:
+ pg_data:
+ neo4j_data:
+ neo4j_logs:
+ neo4j_import:
+ neo4j_plugins:
diff --git a/flowsint-api/Dockerfile b/flowsint-api/Dockerfile
index f74ce2ae..edfd437a 100644
--- a/flowsint-api/Dockerfile
+++ b/flowsint-api/Dockerfile
@@ -1,25 +1,35 @@
-FROM python:3.10
+# --- Production stage ---
+FROM python:3.12-slim AS prod
-WORKDIR /app
+# Environment variables
+ENV PYTHONUNBUFFERED=1
+ENV POETRY_VIRTUALENVS_CREATE=false
+ENV APP_ENV=prod
-# Install git and configure SSH for private repos
-RUN apt-get update && \
- apt-get install -y git openssh-client && \
- rm -rf /var/lib/apt/lists/*
+# Install system dependencies
+RUN apt-get update && apt-get install -y \
+ build-essential \
+ curl \
+ git \
+ && rm -rf /var/lib/apt/lists/*
-# Create SSH directory and configure git to use SSH
-RUN mkdir -p /root/.ssh && \
- ssh-keyscan github.com >> /root/.ssh/known_hosts
+# Install Poetry
+RUN curl -sSL https://install.python-poetry.org | python3 - \
+ && ln -s /root/.local/bin/poetry /usr/local/bin/poetry
-COPY . .
+WORKDIR /app
-# Use SSH for git operations during pip install
-RUN pip install --no-cache-dir -r requirements.txt
+# Copy only dependency files to leverage Docker cache
+COPY pyproject.toml poetry.lock ./
-RUN apt-get update && \
- apt-get install -y git whois dnsutils curl && \
- rm -rf /var/lib/apt/lists/*
+# Install production dependencies only (no dev)
+RUN poetry install --no-dev --no-root
+
+# Copy the source code
+COPY . .
-EXPOSE 5000
+# Expose FastAPI port
+EXPOSE 5001
-ENTRYPOINT ["/app/entrypoint.sh"]
+# Run FastAPI
+CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "5001"]
diff --git a/flowsint-core/Dockerfile b/flowsint-core/Dockerfile
new file mode 100644
index 00000000..579d5016
--- /dev/null
+++ b/flowsint-core/Dockerfile
@@ -0,0 +1,12 @@
+FROM python:3.12-slim
+
+# Installer Poetry
+RUN pip install --no-cache-dir poetry
+
+WORKDIR /app
+COPY ./pyproject.toml ./poetry.lock* /app/
+RUN poetry install --no-root --no-interaction --no-ansi
+
+COPY ./ /app
+
+CMD ["poetry", "run", "celery", "-A", "app.worker", "worker", "--loglevel=info"]