File size: 1,369 Bytes
9c48a49
 
bd2dc07
 
 
 
9c48a49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3411607
 
9c48a49
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
FROM python:3.12-slim

# Force stdout/stderr to be unbuffered to enable live streaming logs in Docker
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1

# Install system dependencies, Redis, supervisor, and curl
RUN apt-get update && apt-get install -y --no-install-recommends \
    curl \
    gnupg \
    redis-server \
    supervisor \
    build-essential \
    libpq-dev \
    && rm -rf /var/lib/apt/lists/*

# Install Redpanda
RUN curl -1sLf 'https://dl.redpanda.com/nzc4ZYQK3WRGd9sy/redpanda/cfg/setup/bash.deb.sh' | bash \
    && apt-get install -y --no-install-recommends redpanda \
    && rm -rf /var/lib/apt/lists/*

# Install uv for rapid Python packaging
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

# Set working directory
WORKDIR /workspace

# Copy dependency files
COPY pyproject.toml uv.lock ./

# Install dependencies using uv
RUN uv sync --frozen

# Copy the rest of the application code
COPY backend ./backend
COPY worker ./worker
# Copy model.onnx if it exists (falls back to downloading from HF Hub if not present)
COPY Dockerfile model.onnx* ./

# Copy supervisord configuration
COPY backend/supervisord.conf /etc/supervisor/conf.d/supervisord.conf

# Expose ports for API, Redpanda, and Redis
EXPOSE 7860 9092 6379

# Run supervisord to start all services
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]