version: '3.8'

services:
  falco:
    image: falcosecurity/falco:0.38.0
    container_name: falco
    privileged: true
    pid: host
    volumes:
      - /var/run/docker.sock:/host/var/run/docker.sock
      - /proc:/host/proc:ro
      - /boot:/host/boot:ro
      - /lib/modules:/host/lib/modules:ro
      - /usr:/host/usr:ro
      - /etc:/host/etc:ro
      - ./falco-rules:/etc/falco/rules.d
      - ./falco-output:/var/log/falco
    command: >
      --modern-bpf
      --json-output
      --log-level=info
    cap_add:
      - SYS_PTRACE
      - SYS_ADMIN
      - CAP_DAC_READ_SEARCH

  target-app:
    image: python:3.11-slim
    container_name: target-app
    working_dir: /app
    volumes:
      - ./app:/app
    command: sleep infinity
    security_opt:
      - "no-new-privileges:true"
    cap_drop:
      - ALL
    read_only: true
    tmpfs:
      - /tmp
      - /run

  attacker:
    image: ubuntu:22.04
    container_name: attacker
    command: sleep infinity
    privileged: true
    pid: host