Spaces:
Running
Running
Create Dockerfile
Browse files- Dockerfile +41 -0
Dockerfile
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.11-slim
|
| 3 |
+
|
| 4 |
+
# Set environment variables for Python
|
| 5 |
+
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 6 |
+
PYTHONUNBUFFERED=1
|
| 7 |
+
|
| 8 |
+
# Set environment variables for Hugging Face cache
|
| 9 |
+
ENV TRANSFORMERS_CACHE=/app/cache \
|
| 10 |
+
HF_HOME=/app/cache
|
| 11 |
+
|
| 12 |
+
# Set the working directory
|
| 13 |
+
WORKDIR /app
|
| 14 |
+
|
| 15 |
+
# Copy the requirements file into the container at /app
|
| 16 |
+
COPY requirements.txt /app/
|
| 17 |
+
|
| 18 |
+
# Install dependencies
|
| 19 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 20 |
+
|
| 21 |
+
# Create and set permissions for the cache directory
|
| 22 |
+
RUN mkdir -p /app/cache /app/VectorDB /app/uploads && \
|
| 23 |
+
chmod -R 777 /app/cache /app/VectorDB /app/uploads
|
| 24 |
+
|
| 25 |
+
# Ensure all relevant directories have the correct permissions
|
| 26 |
+
RUN chmod -R 777 /app/VectorDB
|
| 27 |
+
RUN chmod -R 777 /app/uploads
|
| 28 |
+
RUN chmod -R 777 /app
|
| 29 |
+
|
| 30 |
+
# Copy the rest of the application code to /app
|
| 31 |
+
COPY . /app/
|
| 32 |
+
|
| 33 |
+
# Set environment variables for Flask
|
| 34 |
+
ENV FLASK_APP=app.py \
|
| 35 |
+
FLASK_ENV=production
|
| 36 |
+
|
| 37 |
+
# Expose the port the app runs on
|
| 38 |
+
EXPOSE 7860
|
| 39 |
+
|
| 40 |
+
# Command to run the application
|
| 41 |
+
CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "--timeout", "120", "app:app"]
|