Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +25 -5
Dockerfile
CHANGED
|
@@ -1,7 +1,27 @@
|
|
| 1 |
-
#
|
| 2 |
-
FROM python:3.
|
|
|
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# syntax=docker/dockerfile:1.4
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Install necessary dependencies
|
| 8 |
+
RUN apt-get update && apt-get install -y git
|
| 9 |
+
|
| 10 |
+
# Upgrade pip to the latest version
|
| 11 |
+
RUN pip install --upgrade pip
|
| 12 |
+
|
| 13 |
+
# Create necessary directories and set permissions
|
| 14 |
+
RUN mkdir -p /app && chmod -R 777 /app
|
| 15 |
+
|
| 16 |
+
# Clone private repository using mounted secret
|
| 17 |
+
RUN --mount=type=secret,id=GITHUB_TOKEN,mode=0444,required=true \
|
| 18 |
+
git clone https://x-access-token:$(cat /run/secrets/GITHUB_TOKEN)@github.com/leoncool23/pdpredict.git .
|
| 19 |
+
|
| 20 |
+
# Install Python dependencies
|
| 21 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 22 |
+
|
| 23 |
+
# Expose the port for FastAPI
|
| 24 |
+
EXPOSE 7860
|
| 25 |
+
|
| 26 |
+
# Run the FastAPI app with uvicorn
|
| 27 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|