A third party ATProto appview
at main 36 lines 1.0 kB view raw
1# Python Firehose Consumer - Optimized for high-performance async I/O 2FROM python:3.12-slim 3 4# Install system dependencies 5RUN apt-get update && apt-get install -y \ 6 gcc \ 7 && rm -rf /var/lib/apt/lists/* 8 9# Set working directory 10WORKDIR /app 11 12# Copy requirements and install dependencies 13COPY requirements.txt . 14RUN pip install --no-cache-dir -r requirements.txt 15 16# Copy application code 17COPY firehose_consumer.py . 18 19# Create non-root user 20RUN useradd -m -u 1000 firehose && chown -R firehose:firehose /app 21USER firehose 22 23# Set environment variables (can be overridden in docker-compose) 24ENV PYTHONUNBUFFERED=1 25ENV RELAY_URL=wss://bsky.network 26ENV REDIS_URL=redis://redis:6379 27ENV REDIS_STREAM_KEY=firehose:events 28ENV REDIS_CURSOR_KEY=firehose:python_cursor 29ENV REDIS_MAX_STREAM_LEN=500000 30 31# Health check 32HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ 33 CMD python -c "import redis; r = redis.from_url('${REDIS_URL}'); r.ping()" || exit 1 34 35# Run the consumer 36CMD ["python", "-u", "firehose_consumer.py"]