Professor / Dockerfile
azils3's picture
Update Dockerfile
278a829 verified
raw
history blame
714 Bytes
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
# 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
CMD ["python", "bot.py"]