Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +32 -0
Dockerfile
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.10-slim
|
2 |
+
|
3 |
+
# Install system dependencies for torchaudio and soundfile
|
4 |
+
RUN apt-get update && apt-get install -y \
|
5 |
+
libsndfile1 \
|
6 |
+
ffmpeg \
|
7 |
+
&& rm -rf /var/lib/apt/lists/*
|
8 |
+
|
9 |
+
# Set the working directory in the container
|
10 |
+
WORKDIR /app
|
11 |
+
|
12 |
+
# Copy the requirements file into the container
|
13 |
+
COPY requirements.txt .
|
14 |
+
|
15 |
+
# Install the dependencies
|
16 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
17 |
+
|
18 |
+
# Create the Hugging Face cache directory and set permissions
|
19 |
+
RUN mkdir -p /tmp/hf_cache && chmod -R 777 /tmp/hf_cache
|
20 |
+
|
21 |
+
# Set environment variables for Hugging Face cache
|
22 |
+
ENV HOME=/root
|
23 |
+
ENV HF_HOME=/tmp/hf_cache
|
24 |
+
|
25 |
+
# Copy the rest of your app's code
|
26 |
+
COPY . .
|
27 |
+
|
28 |
+
# Expose the port that FastAPI will run on
|
29 |
+
EXPOSE 8000
|
30 |
+
|
31 |
+
# Command to run the FastAPI app
|
32 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|