Spaces:
Sleeping
Sleeping
File size: 1,612 Bytes
6678fa1 | 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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | # 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"]
|