File size: 1,289 Bytes
ddfcf3e
 
 
57b2069
ddfcf3e
 
 
998f9e8
57b2069
ddfcf3e
 
a2551a8
 
 
 
 
 
 
 
 
 
 
 
 
 
ddfcf3e
 
 
 
a2551a8
 
 
ddfcf3e
3dce5a4
 
 
ddfcf3e
 
 
 
a2551a8
 
 
 
ddfcf3e
 
 
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
# Dockerfile for Hugging Face Spaces - Streamlit App
FROM python:3.10-slim

# Install system dependencies (including git and wget for HF Spaces)
RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    wget \
    git \
    && rm -rf /var/lib/apt/lists/*

# Create user with UID 1000 (required by HF Spaces)
RUN useradd -m -u 1000 user

# Set home directory and working directory
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

WORKDIR $HOME/app

# Copy requirements file and change ownership
COPY --chown=user:user requirements.txt .

# Switch to user before installing dependencies
USER user

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

# Copy application files with proper ownership
COPY --chown=user:user app.py .
COPY --chown=user:user log_parser.py .

# Copy Streamlit configuration for HF Spaces
COPY --chown=user:user .streamlit .streamlit

# Expose port 7860 (Hugging Face Spaces default)
EXPOSE 7860

# Set environment variables for Streamlit
ENV STREAMLIT_SERVER_PORT=7860 \
    STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
    STREAMLIT_SERVER_HEADLESS=true \
    STREAMLIT_BROWSER_GATHER_USAGE_STATS=false

# Run the application
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]