Update Dockerfile
Browse files- Dockerfile +17 -11
Dockerfile
CHANGED
|
@@ -1,21 +1,27 @@
|
|
| 1 |
-
# Use
|
| 2 |
-
FROM
|
| 3 |
|
| 4 |
-
#
|
|
|
|
|
|
|
|
|
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
#
|
|
|
|
|
|
|
|
|
|
| 8 |
COPY requirements.txt .
|
| 9 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 10 |
|
| 11 |
-
#
|
| 12 |
-
RUN pip install --no-cache-dir tensorflow==2.10.0
|
| 13 |
-
|
| 14 |
-
# Copy the FastAPI application
|
| 15 |
COPY app/ ./app/
|
| 16 |
|
| 17 |
-
#
|
|
|
|
|
|
|
|
|
|
| 18 |
EXPOSE 7860
|
| 19 |
|
| 20 |
-
# Run
|
| 21 |
-
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# Use TensorFlow GPU image
|
| 2 |
+
FROM tensorflow/tensorflow:2.10.0-gpu
|
| 3 |
|
| 4 |
+
# ✅ Manually install TensorFlow CPU version
|
| 5 |
+
RUN pip install --no-cache-dir tensorflow==2.10.0
|
| 6 |
+
|
| 7 |
+
# Set working directory
|
| 8 |
WORKDIR /app
|
| 9 |
|
| 10 |
+
# Ensure /tmp is writable
|
| 11 |
+
RUN chmod -R 777 /tmp
|
| 12 |
+
|
| 13 |
+
# Copy requirements and install
|
| 14 |
COPY requirements.txt .
|
| 15 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
|
| 17 |
+
# Copy app source
|
|
|
|
|
|
|
|
|
|
| 18 |
COPY app/ ./app/
|
| 19 |
|
| 20 |
+
# Ensure app directory is readable
|
| 21 |
+
RUN chmod -R 755 /app
|
| 22 |
+
|
| 23 |
+
# Expose port (Hugging Face Spaces expects 7860)
|
| 24 |
EXPOSE 7860
|
| 25 |
|
| 26 |
+
# Run FastAPI app
|
| 27 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|