zonia_chatbot_tts / Dockerfile
ZoniaChatbot's picture
Upload 6 files
645f987 verified
FROM ubuntu:22.04
# Install Python and necessary packages
RUN apt-get update && apt-get install -y python3.10 python3-pip
# Create a user and necessary directories
RUN useradd -m -u 1001 user && mkdir -p /home/user/app/cache
RUN apt-get install -y git git-lfs ffmpeg libsm6 libxext6 cmake rsync libgl1-mesa-glx
RUN git lfs install
# Ensure the cache directory is writable by the user
RUN chown -R user:user /home/user/app/cache && chmod -R 777 /home/user/app/cache
# Install additional packages from packages.txt
RUN --mount=target=/tmp/packages.txt,source=packages.txt apt-get update && \
xargs -r -a /tmp/packages.txt apt-get install -y && rm -rf /var/lib/apt/lists/*
# Install Python requirements
RUN --mount=target=/tmp/requirements.txt,source=requirements.txt pip install --no-cache-dir -r /tmp/requirements.txt
WORKDIR /home/user/app
# Install specific versions of pip and other packages
RUN pip install --no-cache-dir pip==22.3.1 && \
pip install --no-cache-dir datasets "huggingface-hub>=0.19" "hf-transfer>=0.1.4" "protobuf<4" "click<8.1" "pydantic~=1.0"
RUN pip freeze > /tmp/freeze.txt
# Install Gradio and other dependencies
RUN pip install --no-cache-dir gradio[oauth]==4.38.1 "uvicorn>=0.14.0" spaces
# Copy application files and set correct ownership
COPY --link --chown=1001:1001 ./ /home/user/app
#EXPOSE 7860
# Moved up to where the user is added
#RUN mkdir cache
# Set environment variables
#ENV TRANSFORMERS_CACHE=/home/user/app/cache (deprecated)
ENV HF_HOME=/home/user/app/cache
ENV GRADIO_SERVER_NAME="0.0.0.0"
ENV GRADIO_SERVER_PORT=7860
# Switch to the user
USER user
# Copy the app file
COPY app.py .
# Debug: Check permissions of cache directory
RUN ls -l /home/user/app && ls -l /home/user/app/cache
# Run the app
CMD ["python3", "app.py"]