Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +8 -6
Dockerfile
CHANGED
@@ -1,18 +1,20 @@
|
|
1 |
-
# Stage 1: Builder
|
2 |
FROM python:3.9-slim as builder
|
3 |
|
4 |
WORKDIR /app
|
5 |
-
COPY requirements.txt .
|
6 |
|
|
|
7 |
RUN apt-get update && \
|
8 |
apt-get install -y --no-install-recommends \
|
9 |
gcc \
|
10 |
python3-dev \
|
11 |
&& rm -rf /var/lib/apt/lists/*
|
12 |
|
|
|
|
|
13 |
RUN pip install --user --no-cache-dir -r requirements.txt
|
14 |
|
15 |
-
# Stage 2: Runtime
|
16 |
FROM python:3.9-slim
|
17 |
|
18 |
WORKDIR /app
|
@@ -23,14 +25,14 @@ RUN apt-get update && \
|
|
23 |
ffmpeg \
|
24 |
&& rm -rf /var/lib/apt/lists/*
|
25 |
|
26 |
-
# Copy Python dependencies
|
27 |
COPY --from=builder /root/.local /root/.local
|
28 |
COPY --from=builder /app/requirements.txt .
|
29 |
|
30 |
-
#
|
31 |
COPY app.py audio_generator.py ./
|
32 |
|
33 |
-
# Create output directory
|
34 |
RUN mkdir -p /app/tts_outputs && \
|
35 |
chmod 777 /app/tts_outputs
|
36 |
|
|
|
1 |
+
# Stage 1: Builder for dependencies
|
2 |
FROM python:3.9-slim as builder
|
3 |
|
4 |
WORKDIR /app
|
|
|
5 |
|
6 |
+
# Install build dependencies
|
7 |
RUN apt-get update && \
|
8 |
apt-get install -y --no-install-recommends \
|
9 |
gcc \
|
10 |
python3-dev \
|
11 |
&& rm -rf /var/lib/apt/lists/*
|
12 |
|
13 |
+
# Copy and install requirements
|
14 |
+
COPY requirements.txt .
|
15 |
RUN pip install --user --no-cache-dir -r requirements.txt
|
16 |
|
17 |
+
# Stage 2: Runtime image
|
18 |
FROM python:3.9-slim
|
19 |
|
20 |
WORKDIR /app
|
|
|
25 |
ffmpeg \
|
26 |
&& rm -rf /var/lib/apt/lists/*
|
27 |
|
28 |
+
# Copy Python dependencies from builder
|
29 |
COPY --from=builder /root/.local /root/.local
|
30 |
COPY --from=builder /app/requirements.txt .
|
31 |
|
32 |
+
# Copy application files
|
33 |
COPY app.py audio_generator.py ./
|
34 |
|
35 |
+
# Create and configure output directory
|
36 |
RUN mkdir -p /app/tts_outputs && \
|
37 |
chmod 777 /app/tts_outputs
|
38 |
|