Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +27 -7
Dockerfile
CHANGED
@@ -1,16 +1,36 @@
|
|
1 |
-
|
2 |
-
# you will also find guides on how best to write your Dockerfile
|
3 |
|
4 |
-
|
|
|
|
|
|
|
5 |
|
|
|
6 |
RUN useradd -m -u 1000 user
|
7 |
USER user
|
8 |
ENV PATH="/home/user/.local/bin:$PATH"
|
9 |
|
10 |
WORKDIR /app
|
11 |
|
12 |
-
|
13 |
-
RUN
|
|
|
|
|
|
|
|
|
14 |
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.9-slim
|
|
|
2 |
|
3 |
+
# Set environment variables
|
4 |
+
ENV PYTHONDONTWRITEBYTECODE=1
|
5 |
+
ENV PYTHONUNBUFFERED=1
|
6 |
+
ENV PORT=7860
|
7 |
|
8 |
+
# Create a non-root user
|
9 |
RUN useradd -m -u 1000 user
|
10 |
USER user
|
11 |
ENV PATH="/home/user/.local/bin:$PATH"
|
12 |
|
13 |
WORKDIR /app
|
14 |
|
15 |
+
# Install system dependencies
|
16 |
+
RUN apt-get update && apt-get install -y \
|
17 |
+
build-essential \
|
18 |
+
libsndfile1 \
|
19 |
+
ffmpeg \
|
20 |
+
&& rm -rf /var/lib/apt/lists/*
|
21 |
|
22 |
+
# Copy requirements and install Python dependencies
|
23 |
+
COPY --chown=user:users requirements.txt /app/requirements.txt
|
24 |
+
RUN pip install --no-cache-dir --upgrade pip && pip install --no-cache-dir -r requirements.txt
|
25 |
+
|
26 |
+
# Copy the rest of the project files
|
27 |
+
COPY --chown=user:users . /app
|
28 |
+
|
29 |
+
# Ensure outputs and temp directories exist
|
30 |
+
RUN mkdir -p outputs temp
|
31 |
+
|
32 |
+
# Expose port 7860
|
33 |
+
EXPOSE 7860
|
34 |
+
|
35 |
+
# Run the application
|
36 |
+
CMD ["python", "app.py"]
|