File size: 1,057 Bytes
d810052
 
 
060703b
d810052
 
060703b
d810052
060703b
 
 
 
 
 
 
 
 
 
 
 
 
d810052
 
060703b
 
 
 
 
 
 
 
 
 
d810052
 
 
 
 
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
# Use Python 3.9 slim image as base
FROM python:3.9-slim

# Create app directory
WORKDIR /app

# Copy requirements and install dependencies
COPY requirements.txt .
RUN pip install -r requirements.txt

# Create cache directories with proper permissions
RUN mkdir -p /tmp/huggingface \
    && mkdir -p /tmp/transformers \
    && mkdir -p /tmp/sentence-transformers \
    && mkdir -p /tmp/matplotlib \
    && chmod 777 /tmp/huggingface \
    && chmod 777 /tmp/transformers \
    && chmod 777 /tmp/sentence-transformers \
    && chmod 777 /tmp/matplotlib

# Copy application code
COPY . .

# Set environment variables
ENV HF_HOME=/tmp/huggingface
ENV TRANSFORMERS_CACHE=/tmp/transformers
ENV SENTENCE_TRANSFORMERS_HOME=/tmp/sentence-transformers
ENV MPLCONFIGDIR=/tmp/matplotlib
ENV TF_ENABLE_ONEDNN_OPTS=0

# Preload models during build
RUN python -c "from services.api.chatbot.model_init import embedding_model"

# Expose the port
EXPOSE 7860

# Command to run the application
CMD ["uvicorn", "services.api.db.auth:app", "--host", "0.0.0.0", "--port", "7860"]