# Multi-service: Bun server + Python sidecar for dataset uploads FROM oven/bun:1-slim WORKDIR /app # Install Python and supervisor for sidecar RUN apt-get update && apt-get install -y python3 python3-pip python3-venv supervisor && rm -rf /var/lib/apt/lists/* # Create virtual environment for Python RUN python3 -m venv /app/venv # Copy package files for Bun COPY package.json bun.lock ./ RUN bun install --frozen-lockfile --production || (sleep 3 && bun install --frozen-lockfile --production) # Copy Python requirements and install in venv COPY requirements.txt ./ RUN /app/venv/bin/pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Supervisor config RUN echo '[supervisord]\nnodaemon=true\n\n[program:sidecar]\ncommand=/app/venv/bin/python upload_service.py\nstdout_logfile=/dev/stdout\nstdout_logfile_maxbytes=0\nstderr_logfile=/dev/stderr\nstderr_logfile_maxbytes=0\nautostart=true\nautorestart=true\n\n[program:bun]\ncommand=bun index.ts\nstdout_logfile=/dev/stdout\nstdout_logfile_maxbytes=0\nstderr_logfile=/dev/stderr\nstderr_logfile_maxbytes=0\nautostart=true\nautorestart=true\n' > /etc/supervisor/conf.d/supervisord.conf ENV NODE_ENV=production ENV PORT=7860 ENV SIDECAR_URL=http://localhost:7861 EXPOSE 7860 7861 CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]