ml-intern-docker / Dockerfile
Erinaldordso's picture
Override default model to free MiniMax during build
6f58a91 verified
Raw History Blame Contribute Delete
1.78 kB
# ML Intern Docker Space
# Clona o repo oficial, builda frontend e roda o backend web
# Com modelo padrão gratuito (MiniMax) para funcionar sem API keys pagas
FROM python:3.12-slim
# Install system dependencies + nodejs for frontend build
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
curl \
build-essential \
nodejs \
npm \
sed \
&& rm -rf /var/lib/apt/lists/*
# Install uv
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:${PATH}"
# Create user with UID 1000 (required for HF Spaces)
RUN useradd -m -u 1000 user
WORKDIR /app
# Clone the official ml-intern repository
RUN git clone --depth 1 https://github.com/huggingface/ml-intern.git /app && \
rm -rf /app/.git
# Override default model to free HF model (MiniMax) so it works without paid API keys
RUN sed -i 's/bedrock\/us.anthropic.claude-opus-4-6-v1/MiniMaxAI\/MiniMax-M2.7/g' /app/configs/frontend_agent_config.json && \
sed -i 's/anthropic\/claude-opus-4-6/MiniMaxAI\/MiniMax-M2.7/g' /app/configs/cli_agent_config.json && \
cat /app/configs/frontend_agent_config.json
# Build frontend
WORKDIR /app/frontend
RUN npm install && npm run build
# Install Python dependencies and CLI
WORKDIR /app
RUN uv sync --no-dev --frozen && \
uv pip install -e .
# Copy frontend build to static directory
RUN mkdir -p /app/static && cp -r /app/frontend/dist/* /app/static/
# Create directories and set ownership
RUN mkdir -p /app/session_logs && \
chown -R user:user /app
# Switch to non-root user
USER user
# Set environment
ENV HOME=/home/user \
PYTHONUNBUFFERED=1 \
PYTHONPATH=/app \
PATH="/app/.venv/bin:$PATH"
# Expose port
EXPOSE 7860
# Run the web backend
WORKDIR /app/backend
CMD ["bash", "start.sh"]