File size: 899 Bytes
d63c4c5
bc96bf6
278a829
 
 
 
 
 
 
 
 
 
 
bc96bf6
278a829
 
bc96bf6
d63c4c5
 
 
278a829
 
bc96bf6
 
278a829
 
 
 
 
 
 
 
 
d63c4c5
 
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
# File: C:\Users\Shakeel\Desktop\PROFESSOR-BOT\Dockerfile
FROM python:3.10

# Create a non-root user and set up permissions
RUN adduser --disabled-password --gecos '' myuser && \
    mkdir -p /app && \
    chown -R myuser:myuser /app

# Install system dependencies
RUN apt update && apt upgrade -y && \
    apt install git -y

# Copy requirements and install
COPY requirements.txt /requirements.txt
RUN pip install -U pip && \
    pip install -U -r requirements.txt

# Install Flask
RUN pip install Flask

# Switch to non-root user
USER myuser
WORKDIR /app

# Copy application files (preserve ownership)
COPY --chown=myuser:myuser . .

# Set environment variables for file paths
ENV LOG_PATH=/app/BotLog.txt

# Ensure the log file is writable
RUN touch $LOG_PATH && chmod 666 $LOG_PATH

# Run bot and dashboard
CMD ["bash", "-c", "python bot.py & flask run --host=0.0.0.0 --port=7860 --debug=false"]