File size: 1,245 Bytes
428d989
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Use an official Python runtime as a parent image
FROM python:3.9-slim

# Set the working directory in the container
WORKDIR /app

# Copy the current directory contents into the container at /app
ADD . /app

# Install the necessary build tools
RUN apt-get update && \
    apt-get install -y gcc g++ python3-dev && \
    apt-get clean

# Create writable cache and surprise data directories
RUN mkdir -p /app/.cache /app/.surprise_data /tmp

# Set environment variables for cache directories
ENV HF_HOME=/app/.cache
ENV HF_DATASETS_CACHE=/app/.cache
ENV TRANSFORMERS_CACHE=/app/.cache
ENV SURPRISE_DATA_FOLDER=/app/.surprise_data

# Update pip and install specific versions of numpy and other necessary packages
RUN pip install --upgrade pip && \
    pip install --no-cache-dir "numpy<2" && \
    pip install --no-cache-dir -r requirements.txt

# Ensure /tmp is writable, as the app will create the label encoder file there
# Ensure the cache directory is writable
# Ensure the cache directory is writable
RUN mkdir -p /app/cache && chmod -R 777 /app/cache /tmp
 


# Expose port 5016 for the Flask app
EXPOSE 5016

# Run app.py when the container launches
CMD ["gunicorn", "-b", "0.0.0.0:7860","app:app"]