Spaces:
Running
Running
Commit ·
3fff889
1
Parent(s): 6fa522e
Modify dockerfile to have user write permissions
Browse files- Dockerfile +12 -9
Dockerfile
CHANGED
|
@@ -1,19 +1,22 @@
|
|
| 1 |
# Use an official Python runtime as a base image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
-
#
|
| 5 |
ENV PYTHONDONTWRITEBYTECODE=1
|
| 6 |
ENV PYTHONUNBUFFERED=1
|
| 7 |
-
ENV TRANSFORMERS_CACHE=/app/.cache
|
| 8 |
-
# Set working directory inside the container
|
| 9 |
-
WORKDIR /app
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
# Copy and install
|
| 14 |
COPY backend/requirements.txt /app/backend/requirements.txt
|
| 15 |
-
RUN pip install --upgrade pip
|
| 16 |
-
RUN pip install -r /app/backend/requirements.txt
|
| 17 |
|
| 18 |
# Copy the entire project into the container
|
| 19 |
COPY . /app
|
|
@@ -21,5 +24,5 @@ COPY . /app
|
|
| 21 |
# Expose port 8000 (the port our app will run on)
|
| 22 |
EXPOSE 8000
|
| 23 |
|
| 24 |
-
#
|
| 25 |
CMD ["uvicorn", "backend.app:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
|
| 1 |
# Use an official Python runtime as a base image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
+
# Prevent Python from writing .pyc files and enable unbuffered logging
|
| 5 |
ENV PYTHONDONTWRITEBYTECODE=1
|
| 6 |
ENV PYTHONUNBUFFERED=1
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
# Set HF_HOME to a writable cache directory
|
| 9 |
+
ENV HF_HOME=/app/.cache/huggingface
|
| 10 |
+
|
| 11 |
+
# Create the cache directory and ensure it is writable
|
| 12 |
+
RUN mkdir -p /app/.cache/huggingface && chmod -R 777 /app/.cache/huggingface
|
| 13 |
+
|
| 14 |
+
# Set the working directory inside the container
|
| 15 |
+
WORKDIR /app
|
| 16 |
|
| 17 |
+
# Copy and install backend dependencies
|
| 18 |
COPY backend/requirements.txt /app/backend/requirements.txt
|
| 19 |
+
RUN pip install --upgrade pip && pip install -r /app/backend/requirements.txt
|
|
|
|
| 20 |
|
| 21 |
# Copy the entire project into the container
|
| 22 |
COPY . /app
|
|
|
|
| 24 |
# Expose port 8000 (the port our app will run on)
|
| 25 |
EXPOSE 8000
|
| 26 |
|
| 27 |
+
# Run the FastAPI app using Uvicorn
|
| 28 |
CMD ["uvicorn", "backend.app:app", "--host", "0.0.0.0", "--port", "8000"]
|