# Dockerfile FROM python:3.11 # Create a user and set the working directory RUN useradd -ms /bin/bash admin WORKDIR /app # Copy application files and requirements COPY . /app COPY requirement.txt /app/requirements.txt COPY nginx.conf /app/nginx.conf COPY supervisor.conf /app/supervisor.conf # Install dependencies RUN apt-get update -y && apt-get install -y \ nginx \ supervisor \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Install Python dependencies RUN pip3 install --no-cache-dir --upgrade --requirement /app/requirements.txt #USER admin # Adjust permissions RUN chown -R admin:admin /app RUN chmod 777 /app #RUN chown -R admin:admin /etc/* RUN chmod 777 /var/log/supervisor RUN chmod 777 /etc/supervisor RUN chmod 777 /usr/bin/supervisord # Copy Nginx and Supervisor configuration files COPY nginx.conf /etc/nginx/conf.d/default.conf COPY supervisor.conf /etc/supervisor/conf.d/supervisor.conf # Expose ports EXPOSE 7860 # Run Supervisor to manage Nginx and the Python application CMD ["/usr/bin/supervisord"]