Spaces:
Sleeping
Sleeping
| # AI Music Attribution - Full Stack Docker Image | |
| # For deployment on HuggingFace Spaces (Docker SDK) | |
| # | |
| # Build: docker build -t aimusic . | |
| # Run: docker run -p 7860:3000 aimusic | |
| FROM node:20-slim | |
| # Install Python and system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| python3 \ | |
| python3-pip \ | |
| python3-venv \ | |
| ffmpeg \ | |
| libsndfile1 \ | |
| libchromaprint-tools \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create app directory | |
| WORKDIR /app | |
| # Create Python virtual environment | |
| RUN python3 -m venv /app/venv | |
| ENV PATH="/app/venv/bin:$PATH" | |
| ENV PYTHON_PATH="/app/venv/bin/python3" | |
| # Copy Python requirements first (for caching) | |
| COPY ml/requirements.txt ml/requirements.txt | |
| RUN pip install --no-cache-dir -r ml/requirements.txt | |
| # Copy package files and patches | |
| COPY package.json pnpm-lock.yaml ./ | |
| COPY patches/ patches/ | |
| # Install pnpm and Node dependencies | |
| RUN npm install -g pnpm && pnpm install --frozen-lockfile | |
| # Copy application code | |
| COPY . . | |
| # Build frontend | |
| RUN pnpm build | |
| # Create data directories | |
| RUN mkdir -p data/mert_index data/uploads data/training_tracks data/fma_seeds data/test_ai_continuations | |
| # Copy pre-computed embeddings (if available) | |
| # These should be added to your Space's persistent storage | |
| # COPY data/mert_index/embeddings.json data/mert_index/ | |
| # Expose port (HF Spaces expects 7860) | |
| EXPOSE 7860 | |
| # Environment variables | |
| ENV NODE_ENV=production | |
| ENV PORT=7860 | |
| ENV HOST=0.0.0.0 | |
| # ML optimization: enable multi-threading and ONNX | |
| ENV OMP_NUM_THREADS=8 | |
| ENV MKL_NUM_THREADS=8 | |
| ENV OPENBLAS_NUM_THREADS=8 | |
| ENV USE_ONNX=0 | |
| # Start the server | |
| CMD ["pnpm", "start"] | |