Spaces:
Runtime error
Runtime error
Initial Dockerfile for Nigerian TTS API
Browse filesThis Dockerfile sets up a Python environment for the FastAPI-based Nigerian Text-to-Speech API. It:
- Uses Python 3.9 as the base image
- Installs necessary system dependencies
- Sets up a non-root user for security
- Configures directories for models and audio files
- Launches the FastAPI application using uvicorn
- Dockerfile +30 -0
Dockerfile
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.9
|
2 |
+
|
3 |
+
# Install system dependencies
|
4 |
+
RUN apt-get update && apt-get install -y \
|
5 |
+
wget \
|
6 |
+
&& rm -rf /var/lib/apt/lists/*
|
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 |
+
# Set working directory
|
14 |
+
WORKDIR /app
|
15 |
+
|
16 |
+
# Copy requirements file
|
17 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
18 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
19 |
+
|
20 |
+
# Copy application code
|
21 |
+
COPY --chown=user ./main.py /app/
|
22 |
+
COPY --chown=user ./.gitignore /app/
|
23 |
+
COPY --chown=user ./README.md /app/
|
24 |
+
|
25 |
+
# Create directories for models and audio files
|
26 |
+
RUN mkdir -p /app/models
|
27 |
+
RUN mkdir -p /app/audio_files
|
28 |
+
|
29 |
+
# Run the application
|
30 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|