File size: 1,171 Bytes
18932ad
dde3768
18932ad
 
 
 
dde3768
18932ad
 
 
dde3768
18932ad
606c049
dde3768
 
606c049
 
 
 
 
 
 
dde3768
 
18932ad
 
 
dde3768
 
 
 
 
 
 
 
 
18932ad
dde3768
 
 
 
 
18932ad
dde3768
 
 
 
 
 
 
 
 
 
 
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
FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1

# System deps (FFmpeg 4.4 compatible)
RUN apt-get update && apt-get install -y \
    python3.10 \
    python3.10-dev \
    python3-pip \
    git \
    ffmpeg \
    pkg-config \
    libgl1 \
    libglib2.0-0 \
    libavcodec-dev \
    libavformat-dev \
    libavdevice-dev \
    libavfilter-dev \
    libavutil-dev \
    libswscale-dev \
    libswresample-dev \
    && rm -rf /var/lib/apt/lists/*

# Make python default
RUN ln -s /usr/bin/python3.10 /usr/bin/python

# User
RUN useradd -m -u 1000 user
USER user
ENV PATH=/home/user/.local/bin:$PATH
WORKDIR /app

# Upgrade pip
RUN pip install --upgrade pip setuptools wheel

# Install torch (CPU)
RUN pip install \
    torch==2.1.0+cpu \
    torchaudio==2.1.0+cpu \
    --index-url https://download.pytorch.org/whl/cpu

# Install audiocraft (NOW SUCCEEDS)
RUN pip install \
    git+https://github.com/facebookresearch/audiocraft.git@v1.3.0

# App deps
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy app
COPY --chown=user . /app

CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]