Spaces:
Building
Building
# syntax=docker/dockerfile:1.2 | |
FROM continuumio/miniconda3:24.1.2-0 | |
USER root | |
WORKDIR /app | |
# Copy all repo files into /app | |
COPY . /app | |
# Run the torchserve setup script that replicates steps from the original torchserve/Dockerfile | |
RUN chmod +x /app/torchserve_setup.sh && /app/torchserve_setup.sh | |
# Install your package in editable mode | |
RUN pip install -e . | |
# IMPORTANT: Change ownership of /app to the non-root user (with UID 1000) | |
# Hugging Face Spaces runs the container as a non-root user with UID 1000 by default. | |
RUN chown -R 1000:1000 /app | |
# Switch to the non-root user | |
USER 1000 | |
# Expose port 7860 for Gradio on Hugging Face Spaces | |
EXPOSE 7860 | |
# Run the Gradio app as the non-root user now that it has proper permissions | |
CMD ["python", "app.py"] |