File size: 1,453 Bytes
d086b80
c6e228d
d086b80
 
 
 
 
 
 
 
a4dc38c
 
 
 
 
 
25f34c8
 
76c02cd
a4dc38c
 
 
 
 
 
0b6c9bf
 
 
a4dc38c
25f34c8
76c02cd
a4dc38c
 
d086b80
 
 
 
 
 
 
 
 
0de5893
d086b80
 
 
 
 
 
 
 
 
 
 
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
# Use an official Python runtime as a parent image
FROM python:3.10-slim

# Set the working directory in the container
WORKDIR /app

# Install system dependencies
# - git: for installing python packages from git
# - ffmpeg: for audio processing with pydub/librosa
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    git \
    ffmpeg \
    libsndfile1 \
    libsndfile1-dev \
    build-essential \
    python3-dev \
    libhdf5-dev \
    llvm \
    && rm -rf /var/lib/apt/lists/*

ENV NUMBA_CACHE_DIR=/tmp/numba_cache
ENV NUMBA_DISABLE_JIT=1
ENV NUMBA_DISABLE_CUDA=1
ENV NUMBA_DISABLE_LLVM=1
ENV NUMBA_LLVM_DEBUG=0
ENV NUMBA_DEBUG=0
ENV NUMBA_WARNINGS=0
ENV PYTHONPATH=/app
ENV TF_CPP_MIN_LOG_LEVEL=2
ENV LLVM_CONFIG=/usr/bin/llvm-config

RUN mkdir -p /tmp/numba_cache && chmod 777 /tmp/numba_cache

# Copy the requirements file into the container
COPY requirements.txt .

# Install Python dependencies
# Using --no-cache-dir to reduce image size
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code into the container
COPY . .

# Make port 7860 available to the world outside this container
# Hugging Face Spaces often use this port by default
EXPOSE 7860

# Define environment variable for the port (optional, uvicorn command below sets it)
ENV PORT 7860

# Run the application
# Use 0.0.0.0 to allow external connections
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]