uuserrbottt / Dockerfile
xdragxt's picture
Update Dockerfile
81689d5 verified
# Base image with full Debian repo support
FROM python:3.11-bullseye
# Set timezone
ENV TZ=Asia/Kolkata
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Install required system packages
RUN apt-get update && apt-get install -y --no-install-recommends \
gdb \
git \
gcc \
python3-dev \
ffmpeg \
mediainfo \
curl \
neofetch \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Create a non-root user
RUN useradd -m user
# Set working directory
WORKDIR /app
# Copy project files
COPY . .
# Avoid pip install as root errors
ENV PIP_ROOT_USER_ACTION=ignore
ENV PATH="/home/user/.local/bin:$PATH"
# Upgrade pip and install Python dependencies
RUN pip install --upgrade pip
RUN pip install --no-cache-dir uvicorn fastapi
RUN pip install --no-cache-dir --verbose -r requirements.txt
# Ensure required directories exist with correct permissions
RUN mkdir -p /app/sessions /app/resources/auth /app/tmp /app/pdf /app/addons && \
chmod -R 777 /app/sessions /app/resources /app/tmp /app/pdf /app/addons && \
chown -R user:user /app
# Fix relative imports (make packages)
RUN touch /app/__init__.py /app/addons/__init__.py /app/pyUltroid/__init__.py
# Create addons directory structure
RUN mkdir -p /app/addons && \
chmod -R 777 /app/addons
# Set Python path
ENV PYTHONPATH="${PYTHONPATH}:/app"
# Switch to non-root user
USER user
# Make startup script executable
RUN chmod +x /app/startup
# Start startup script in background, then run server.py
CMD bash -c "./startup & exec python3 server.py"