File size: 1,496 Bytes
eed6dfe
 
ff17fc2
b75aa0b
eed6dfe
 
4ff5731
b2bcd2f
 
 
cf90b95
b2bcd2f
b75aa0b
ff17fc2
 
b75aa0b
b2bcd2f
 
 
 
 
 
 
23ca858
b2bcd2f
 
 
b75aa0b
 
7a7785f
b2bcd2f
 
23ca858
eed6dfe
 
ff17fc2
b75aa0b
b2bcd2f
ff17fc2
b75aa0b
 
ff17fc2
b75aa0b
eed6dfe
 
b75aa0b
ff17fc2
 
eed6dfe
 
 
 
b75aa0b
eed6dfe
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Use an official Python runtime as a parent image
FROM python:3.9-slim

# Set environment variables for Python
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# Set environment variables
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
ENV PATH="/home/user/.local/bin:$PATH"
ENV HF_HOME="/home/user/.cache/huggingface" 

# Set the working directory
WORKDIR /app

# Install system dependencies, including libgomp
#RUN apt-get update && apt-get install -y \
#    libgl1-mesa-glx \
#    libgomp1 \
#    libglib2.0-0 \
#    && rm -rf /var/lib/apt/lists/*

# Install Python, pip, and other dependencies
RUN apt-get update && apt-get install -y \
    python3 \
    python3-pip \
    python3-dev \
    libgl1-mesa-glx \
    libgomp1 \
    libglib2.0-0 \
    libgthread-2.0-0 \
    && apt-get clean && rm -rf /var/lib/apt/lists/*

# Copy the requirements file into the container at /app
COPY requirements.txt /app/

# Install any needed packages specified in requirements.txt
RUN pip3 install --no-cache-dir --upgrade -r requirements.txt

# Create directories for session storage and uploads
RUN mkdir -p /app/flask_sessions /app/uploads && chmod -R 777 /app/flask_sessions /app/uploads

# Copy the rest of the application code to /app
COPY . /app/

# Expose the port that the app runs on
EXPOSE 7860

# Set environment variables for Flask
ENV FLASK_APP=app.py
ENV FLASK_ENV=production

# Command to run the Flask app using Gunicorn
CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "--timeout", "120", "app:app"]