text2speech_docker / Dockerfile
manhteky123's picture
Upload 5 files
258b448 verified
# Base image
FROM docker.io/library/python:3.10@sha256:eebca922adbff26c092545ebe3783c37623f30ffda618559d3cede33d7d468a9
# Install Node.js 20.x
RUN apt-get update && \
apt-get install -y curl && \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs && \
rm -rf /var/lib/apt/lists/* && apt-get clean
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
git-lfs \
ffmpeg \
libsm6 \
libxext6 \
cmake \
rsync \
libgl1 \
fakeroot \
&& rm -rf /var/lib/apt/lists/* \
&& git lfs install
# Setup apt-get with fakeroot wrapper
RUN mv /usr/bin/apt-get /usr/bin/.apt-get && \
echo '#!/usr/bin/env sh\nfakeroot /usr/bin/.apt-get $@' > /usr/bin/apt-get && \
chmod +x /usr/bin/apt-get
# Create user
RUN useradd -m -u 1000 user
# Set working directory
WORKDIR /home/user/app
# Copy requirements and install Python dependencies
COPY --chown=1000:1000 requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir pip -U && \
pip install --no-cache-dir -r /tmp/requirements.txt
# Install additional Python packages
RUN pip install --no-cache-dir \
datasets \
"huggingface-hub>=0.19" \
"hf_xet>=1.0.0,<2.0.0" \
"hf-transfer>=0.1.4" \
"protobuf<4" \
"click<8.1" \
"pydantic==2.10.6"
# Install Gradio and related packages
RUN pip install --no-cache-dir \
gradio[oauth,mcp]==5.36.2 \
"uvicorn>=0.14.0" \
spaces
# Copy application code
COPY --chown=1000:1000 . /home/user/app
# Switch to non-root user
USER user
# Expose port (adjust if needed)
EXPOSE 7860
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV FLASK_APP=flask_app.py
# Run the Flask application
CMD ["python", "flask_app.py"]