File size: 651 Bytes
e21c1a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.9

# Create and switch to a non-root user
RUN useradd -m -u 1000 user
USER root
ENV PATH="/home/user/.local/bin:$PATH"

WORKDIR /app
RUN apt-get update && apt-get install -y pandoc

# Create uploads dir (if used later) and set permissions
RUN mkdir -p /app/uploads && chown user:user /app/uploads

# Install dependencies
COPY --chown=user:user requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Copy source code
COPY --chown=user:user . /app

# Switch to non-root user
USER user

# Start FastAPI app (which internally starts the bot)
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]