Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +8 -1
Dockerfile
CHANGED
|
@@ -4,6 +4,7 @@ FROM python:3.9-slim
|
|
| 4 |
# Set environment variables
|
| 5 |
ENV PYTHONDONTWRITEBYTECODE 1
|
| 6 |
ENV PYTHONUNBUFFERED 1
|
|
|
|
| 7 |
|
| 8 |
# Install system dependencies
|
| 9 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
@@ -15,6 +16,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 15 |
# Set the working directory
|
| 16 |
WORKDIR /app
|
| 17 |
|
|
|
|
|
|
|
|
|
|
| 18 |
# Copy requirements.txt into the container
|
| 19 |
COPY requirements.txt .
|
| 20 |
|
|
@@ -24,8 +28,11 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 24 |
# Copy the application code
|
| 25 |
COPY . .
|
| 26 |
|
|
|
|
|
|
|
|
|
|
| 27 |
# Expose the port for the FastAPI application
|
| 28 |
EXPOSE 7860
|
| 29 |
|
| 30 |
# Command to run the FastAPI app
|
| 31 |
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 4 |
# Set environment variables
|
| 5 |
ENV PYTHONDONTWRITEBYTECODE 1
|
| 6 |
ENV PYTHONUNBUFFERED 1
|
| 7 |
+
ENV TORCH_HOME=/app/.cache # Set the torch cache directory
|
| 8 |
|
| 9 |
# Install system dependencies
|
| 10 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
| 16 |
# Set the working directory
|
| 17 |
WORKDIR /app
|
| 18 |
|
| 19 |
+
# Create necessary directories and set permissions
|
| 20 |
+
RUN mkdir -p /app/.cache && chmod -R 777 /app
|
| 21 |
+
|
| 22 |
# Copy requirements.txt into the container
|
| 23 |
COPY requirements.txt .
|
| 24 |
|
|
|
|
| 28 |
# Copy the application code
|
| 29 |
COPY . .
|
| 30 |
|
| 31 |
+
# Set permissions for all files and directories in /app
|
| 32 |
+
RUN chmod -R 777 /app
|
| 33 |
+
|
| 34 |
# Expose the port for the FastAPI application
|
| 35 |
EXPOSE 7860
|
| 36 |
|
| 37 |
# Command to run the FastAPI app
|
| 38 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|