File size: 1,234 Bytes
04f095f
3c746b0
 
04f095f
 
 
3c746b0
04f095f
3c746b0
04f095f
3c746b0
04f095f
3c746b0
 
04f095f
0eca8d7
3c746b0
04f095f
 
 
 
 
 
 
de32f63
a10a589
04f095f
3c746b0
2b70b27
 
 
 
04f095f
 
3c746b0
04f095f
 
3c746b0
04f095f
 
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 the official Python image as a base
FROM python:3.9.13

# Set environment variables
ENV HOME=/home/user
ENV PATH=$HOME/.local/bin:$PATH

# Create a non-root user and set ownership for HOME directory
RUN useradd -m -u 1000 user
RUN chown -R user:user $HOME

# Set the working directory
WORKDIR $HOME/app

# Clone the shap-e repository from GitHub (optional based on your needs)
RUN git clone https://github.com/openai/shap-e .

# Copy the local app files into the container
COPY --chown=user . .

# Create a requirements.txt file with specified dependencies
RUN echo "-e ." > requirements.txt \
    && echo "flask" >> requirements.txt \
    && echo "flask_cors" >> requirements.txt \
    && echo "PyYAML" >> requirements.txt \
    && echo "ipywidgets" >> requirements.txt \
    && echo "gunicorn" >> requirements.txt

# Create a directory for model cache with appropriate permissions
RUN mkdir -p $HOME/app/shap_e_model_cache
RUN chown -R user:user $HOME/app/shap_e_model_cache

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Set Numba cache directory (optional)
ENV NUMBA_CACHE_DIR=/tmp/numba_cache

# Default command to run the application
CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]