Spaces:
Running
Running
Update run.sh
Browse files
run.sh
CHANGED
|
@@ -1,12 +1,23 @@
|
|
| 1 |
-
#
|
|
|
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
|
| 5 |
-
|
|
|
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official lightweight Python image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
|
| 4 |
+
# Hugging Face Spaces require the app to run as user '1000'
|
| 5 |
+
RUN useradd -m -u 1000 user
|
| 6 |
+
USER user
|
| 7 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 8 |
|
| 9 |
+
# Set the working directory inside the container
|
| 10 |
+
WORKDIR /app
|
| 11 |
|
| 12 |
+
# Copy all your local files into the container
|
| 13 |
+
COPY --chown=user . /app
|
| 14 |
+
|
| 15 |
+
# Install all your Python packages
|
| 16 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 17 |
+
|
| 18 |
+
# Expose port 7860
|
| 19 |
+
EXPOSE 7860
|
| 20 |
+
|
| 21 |
+
# BYPASS run.sh and run everything directly in the Docker CMD
|
| 22 |
+
# This prevents the Windows/Linux invisible character crash
|
| 23 |
+
CMD ["bash", "-c", "uvicorn api.main:app --host 127.0.0.1 --port 8000 & sleep 10 && streamlit run frontend/app.py --server.port 7860 --server.address 0.0.0.0"]
|