File size: 1,572 Bytes
86329b0
 
 
 
 
 
 
 
 
 
5a7b71a
 
 
 
86329b0
 
 
 
b15dbc8
 
86329b0
 
 
 
da824e6
 
 
4e11e98
d6c141f
da824e6
4e11e98
d6c141f
 
86329b0
 
d94d1c0
86329b0
 
 
 
4e11e98
 
d6c141f
d94d1c0
062a362
5a7b71a
062a362
5ebebc8
062a362
 
5ebebc8
 
 
 
 
 
d94d1c0
062a362
86329b0
 
062a362
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
56
57
58
59
60
61
FROM python:3.11-slim

WORKDIR /app

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

# Create necessary directories with proper permissions
RUN mkdir -p /app/data/planogram001 /app/assets && \
    chmod -R 777 /app/data /app/assets

# Copy requirements first to leverage Docker cache
COPY requirements.txt .

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

# Copy the rest of the application
COPY . .

# Create necessary directories and set permissions
RUN mkdir -p data/planogram001 && \
    mkdir -p .files && \
    mkdir -p /.cache && \
    mkdir -p .chainlit/assets && \
    chmod -R 777 .files && \
    chmod -R 777 data && \
    chmod -R 777 /.cache && \
    chmod -R 777 .chainlit

# Expose the port Chainlit runs on
EXPOSE 7860

# Set environment variables
ENV PYTHONPATH=/app
ENV HF_HUB_ENABLE_HF_TRANSFER=1
ENV TRANSFORMERS_CACHE=/.cache
ENV HF_HOME=/.cache
ENV CHAINLIT_SERVER_HOST=0.0.0.0
ENV CHAINLIT_SERVER_PORT=7860
ENV CHAINLIT_DEBUG=1
ENV PYTHONUNBUFFERED=1

# Create a startup script with debugging
RUN echo '#!/bin/bash\n\
echo "Starting Chainlit server..."\n\
echo "Current directory: $(pwd)"\n\
echo "Directory contents:"\n\
ls -la\n\
echo "Chainlit config:"\n\
cat .chainlit/config.toml\n\
echo "Starting server..."\n\
chainlit run app.py --host 0.0.0.0 --port 7860 --debug\n\
' > /app/start.sh && chmod +x /app/start.sh

# Run the application
CMD ["/app/start.sh"]