File size: 810 Bytes
54cea74
0e8666b
 
54cea74
0e8666b
d868d22
 
 
54cea74
d868d22
 
54cea74
 
 
 
 
d868d22
54cea74
 
d868d22
54cea74
aec0d06
54cea74
 
74be2a4
d868d22
54cea74
dd88012
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
# Use official lightweight Python image
FROM python:3.10-slim

# Set a working directory with write permissions
WORKDIR /app

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

# Create a non-root user and switch to it
RUN adduser --disabled-password --gecos '' appuser
USER appuser
ENV HOME=/home/appuser
ENV PATH="${HOME}/.local/bin:${PATH}"

# Copy the app script (assumes app.py is in the same folder)
COPY --chown=appuser:appuser app.py .

# Install Python packages in user space
RUN python -m pip install --no-cache-dir python-telegram-bot==20.0 requests fastapi uvicorn

# Expose Flask port required by Hugging Face Spaces
EXPOSE 7860

# Run the app as non-root user
CMD ["python", "app.py"]