Spaces:
Sleeping
Sleeping
# Use a base image with espeak pre-installed (adjust based on your needs) | |
FROM ubuntu:22.04 | |
# Create a user for the application | |
RUN useradd -m -u 1000 user | |
# Switch to the user | |
USER user | |
# Set environment variables | |
ENV HOME=/home/user \ | |
PATH=/home/user/.local/bin:$PATH | |
# Set working directory | |
WORKDIR $HOME/app | |
# Copy application files and requirements | |
COPY --chown=user . $HOME/app | |
COPY ./requirements.txt $HOME/app/requirements.txt | |
# Install espeak-ng (assuming it's used in your application) | |
RUN apt-get update && \ | |
apt-get install espeak-ng && \ | |
apt-get clean && \ | |
rm -rf /var/lib/apt/lists/* | |
# Install other Python dependencies from requirements.txt | |
RUN pip install --no-cache-dir -r requirements.txt | |
RUN predictions.py | |
# Handle architecture mismatch for Apple Silicon (optional) | |
# If using Apple Silicon with Ventura and above, uncomment the following block | |
# and adjust the paths based on your system | |
# USER root | |
# RUN apt-get update && \ | |
# apt-get install software-properties-common && \ | |
# add-apt-repository ppa:deadsnakes/ppa && \ | |
# apt-get update && \ | |
# apt-get install python3.11-arm64 && \ | |
# apt-get clean && \ | |
# rm -rf /var/lib/apt/lists/* | |
# | |
# USER user | |
# ENV PYTHONIOENCODING=utf-8 | |
# ENV PATH=/usr/lib/python3.11/bin:$PATH | |
# Start the application (assuming app.py is the entry point) | |
CMD ["python", "app.py"] | |