Spaces:
Paused
Paused
File size: 1,336 Bytes
df8a152 32f52b5 f5571f6 69daece df8a152 32f52b5 69daece df8a152 69daece df8a152 32f52b5 f5571f6 32f52b5 df8a152 32f52b5 df8a152 32f52b5 f5571f6 | 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 | # 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"]
|