FROM python:3.9 # Create user first RUN useradd -m -u 1000 aim_user # Perform root operations: Install packages, copy system configs RUN apt-get update && apt-get install -y nginx procps && rm -rf /var/lib/apt/lists/* COPY nginx.conf /etc/nginx/nginx.conf COPY start.sh /start.sh RUN chmod +x /start.sh # Now switch to the final user USER aim_user # Set home and path ENV HOME=/home/aim_user \ PATH=/home/aim_user/.local/bin:$PATH # Set the working directory WORKDIR $HOME # install aim (as aim_user) RUN pip install aim --no-cache-dir ENTRYPOINT ["/bin/sh", "-c"] COPY aim_repo.tar.gz . RUN tar xvzf aim_repo.tar.gz # Port 43800 for UI, 53800 for Server. Nginx listens on 7860. # Run the startup script as aim_user CMD ["/start.sh"]