fix permission error
Browse files- Dockerfile +12 -11
Dockerfile
CHANGED
|
@@ -1,24 +1,25 @@
|
|
| 1 |
-
# Use the
|
| 2 |
FROM python:3.9
|
| 3 |
|
| 4 |
-
# Set the working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Copy
|
| 8 |
COPY requirements.txt .
|
| 9 |
-
|
| 10 |
-
# Install the dependencies
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
|
| 13 |
-
#
|
| 14 |
-
RUN mkdir -p /app/.cache
|
| 15 |
-
|
| 16 |
-
# Set environment variables for the cache directory
|
| 17 |
-
ENV TRANSFORMERS_CACHE=/app/.cache
|
| 18 |
ENV HF_HOME=/app/.cache
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
# Copy the
|
| 21 |
COPY . .
|
| 22 |
|
|
|
|
|
|
|
|
|
|
| 23 |
# Command to run the application
|
| 24 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
|
| 1 |
+
# Use the existing base image
|
| 2 |
FROM python:3.9
|
| 3 |
|
| 4 |
+
# Set the working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Copy requirements file and install dependencies
|
| 8 |
COPY requirements.txt .
|
|
|
|
|
|
|
| 9 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 10 |
|
| 11 |
+
# Set the HF_HOME environment variable to a writable directory
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
ENV HF_HOME=/app/.cache
|
| 13 |
+
ENV TRANSFORMERS_CACHE=/app/.cache
|
| 14 |
+
|
| 15 |
+
# Create the huggingface directory and set the correct permissions
|
| 16 |
+
RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
|
| 17 |
|
| 18 |
+
# Copy the application files
|
| 19 |
COPY . .
|
| 20 |
|
| 21 |
+
# Expose the port (if needed)
|
| 22 |
+
EXPOSE 8000
|
| 23 |
+
|
| 24 |
# Command to run the application
|
| 25 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|