File size: 762 Bytes
706df25
4e6448d
706df25
4e6448d
 
706df25
4e6448d
29c746e
706df25
4e6448d
29c746e
706df25
4e6448d
706df25
 
4e6448d
29c746e
 
 
 
 
 
 
706df25
 
4e6448d
29c746e
706df25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 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"]