Update Dockerfile
Browse files- Dockerfile +6 -9
Dockerfile
CHANGED
@@ -1,10 +1,9 @@
|
|
1 |
-
# File: C:\Users\Shakeel\Desktop\PROFESSOR-BOT\Dockerfile
|
2 |
FROM python:3.10
|
3 |
|
4 |
# Create a non-root user and set up permissions
|
5 |
-
RUN adduser --disabled-password --gecos ''
|
6 |
mkdir -p /app && \
|
7 |
-
chown -R
|
8 |
|
9 |
# Install system dependencies
|
10 |
RUN apt update && apt upgrade -y && \
|
@@ -15,21 +14,19 @@ COPY requirements.txt /requirements.txt
|
|
15 |
RUN pip install -U pip && \
|
16 |
pip install -U -r requirements.txt
|
17 |
|
18 |
-
# Install Flask
|
19 |
-
RUN pip install Flask
|
20 |
-
|
21 |
# Switch to non-root user
|
22 |
-
USER
|
23 |
WORKDIR /app
|
24 |
|
25 |
# Copy application files (preserve ownership)
|
26 |
-
COPY --chown=
|
27 |
|
28 |
# Set environment variables for file paths
|
29 |
ENV LOG_PATH=/app/BotLog.txt
|
|
|
30 |
|
31 |
# Ensure the log file is writable
|
32 |
RUN touch $LOG_PATH && chmod 666 $LOG_PATH
|
33 |
|
34 |
# Run bot and dashboard
|
35 |
-
CMD ["bash", "-c", "python bot.py & flask run --host=0.0.0.0 --port=7860
|
|
|
|
|
1 |
FROM python:3.10
|
2 |
|
3 |
# Create a non-root user and set up permissions
|
4 |
+
RUN adduser --disabled-password --gecos '' Professor && \
|
5 |
mkdir -p /app && \
|
6 |
+
chown -R Professor:Professor /app
|
7 |
|
8 |
# Install system dependencies
|
9 |
RUN apt update && apt upgrade -y && \
|
|
|
14 |
RUN pip install -U pip && \
|
15 |
pip install -U -r requirements.txt
|
16 |
|
|
|
|
|
|
|
17 |
# Switch to non-root user
|
18 |
+
USER Professor
|
19 |
WORKDIR /app
|
20 |
|
21 |
# Copy application files (preserve ownership)
|
22 |
+
COPY --chown=Professor:Professor . .
|
23 |
|
24 |
# Set environment variables for file paths
|
25 |
ENV LOG_PATH=/app/BotLog.txt
|
26 |
+
ENV FLASK_DEBUG=0
|
27 |
|
28 |
# Ensure the log file is writable
|
29 |
RUN touch $LOG_PATH && chmod 666 $LOG_PATH
|
30 |
|
31 |
# Run bot and dashboard
|
32 |
+
CMD ["bash", "-c", "python bot.py & flask run --host=0.0.0.0 --port=7860"]
|