Upload Dockerfile
Browse files- Dockerfile +19 -0
Dockerfile
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.10
|
| 2 |
+
|
| 3 |
+
# 1. Create the specific user required by Hugging Face Spaces
|
| 4 |
+
RUN useradd -m -u 1000 user
|
| 5 |
+
USER user
|
| 6 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 7 |
+
|
| 8 |
+
# 2. Set the working directory to that user's safe space
|
| 9 |
+
WORKDIR /home/user/app
|
| 10 |
+
|
| 11 |
+
# 3. Copy requirements and install them securely
|
| 12 |
+
COPY --chown=user:user requirements.txt .
|
| 13 |
+
RUN pip install --user --no-cache-dir -r requirements.txt
|
| 14 |
+
|
| 15 |
+
# 4. Copy your app.py and images into the safe space
|
| 16 |
+
COPY --chown=user:user . .
|
| 17 |
+
|
| 18 |
+
# 5. Launch using the Python Module bypass (The Fix!)
|
| 19 |
+
CMD ["python", "-m", "streamlit", "run", "app.py", "--server.port", "7860", "--server.address", "0.0.0.0"]
|