| 1 | # Use NVIDIA CUDA runtime as parent image (includes CUDA 12.1 + cuDNN 8) |
| 2 | FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04 |
| 3 | |
| 4 | # Avoid interactive timezone prompt |
| 5 | ENV DEBIAN_FRONTEND=noninteractive |
| 6 | |
| 7 | # Set the working directory in the container |
| 8 | WORKDIR /MoneyPrinterTurbo |
| 9 | RUN chmod 777 /MoneyPrinterTurbo |
| 10 | |
| 11 | ENV PYTHONPATH="/MoneyPrinterTurbo" |
| 12 | |
| 13 | # Install Python 3.11 and system dependencies |
| 14 | RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 15 | software-properties-common \ |
| 16 | git \ |
| 17 | imagemagick \ |
| 18 | ffmpeg \ |
| 19 | curl \ |
| 20 | && add-apt-repository ppa:deadsnakes/ppa \ |
| 21 | && apt-get update && apt-get install -y --no-install-recommends \ |
| 22 | python3.11 \ |
| 23 | python3.11-venv \ |
| 24 | python3.11-dev \ |
| 25 | python3-pip \ |
| 26 | && ln -sf /usr/bin/python3.11 /usr/bin/python3 \ |
| 27 | && ln -sf /usr/bin/python3.11 /usr/bin/python \ |
| 28 | && python3.11 -m pip install --upgrade pip \ |
| 29 | && apt-get remove -y python3-blinker || true \ |
| 30 | && rm -rf /var/lib/apt/lists/* |
| 31 | |
| 32 | # Fix security policy for ImageMagick |
| 33 | RUN sed -i '/<policy domain="path" rights="none" pattern="@\*"/d' /etc/ImageMagick-6/policy.xml |
| 34 | |
| 35 | # Copy only the requirements.txt first to leverage Docker cache |
| 36 | COPY requirements.txt ./ |
| 37 | |
| 38 | # Install Python dependencies |
| 39 | RUN python3 -m pip install --no-cache-dir \ |
| 40 | -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com \ |
| 41 | --retries 3 --timeout 60 -r requirements.txt || \ |
| 42 | python3 -m pip install --no-cache-dir \ |
| 43 | -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/ --trusted-host mirrors.tuna.tsinghua.edu.cn \ |
| 44 | --retries 3 --timeout 60 -r requirements.txt || \ |
| 45 | python3 -m pip install --no-cache-dir \ |
| 46 | --retries 3 --timeout 60 -r requirements.txt |
| 47 | |
| 48 | # Now copy the rest of the codebase into the image |
| 49 | COPY . . |
| 50 | |
| 51 | # Expose the port the app runs on |
| 52 | EXPOSE 8501 |
| 53 | |
| 54 | # Command to run the application |
| 55 | CMD ["streamlit", "run", "./webui/Main.py","--browser.serverAddress=127.0.0.1","--server.enableCORS=True","--browser.gatherUsageStats=False","--server.showEmailPrompt=False"] |
| 56 |