Files
MoneyPrinterTurbo/Dockerfile.gpu
T
SUMDDOSandClaude Opus 4.6 39d5894992 feat: add GPU support via Dockerfile.gpu and docker-compose.gpu.yml
- Restore original Dockerfile and docker-compose.yml (no breaking changes)
- Add Dockerfile.gpu with NVIDIA CUDA 12.1 base image
- Add docker-compose.gpu.yml as compose override for GPU deployment
- Update GPU deployment documentation with both CPU and GPU instructions

CPU users: docker compose up -d (unchanged)
GPU users: docker compose -f docker-compose.yml -f docker-compose.gpu.yml up -d

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 03:20:31 +08:00

56 lines
2.0 KiB
Docker

# Use NVIDIA CUDA runtime as parent image (includes CUDA 12.1 + cuDNN 8)
FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
# Avoid interactive timezone prompt
ENV DEBIAN_FRONTEND=noninteractive
# Set the working directory in the container
WORKDIR /MoneyPrinterTurbo
RUN chmod 777 /MoneyPrinterTurbo
ENV PYTHONPATH="/MoneyPrinterTurbo"
# Install Python 3.11 and system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
software-properties-common \
git \
imagemagick \
ffmpeg \
curl \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt-get update && apt-get install -y --no-install-recommends \
python3.11 \
python3.11-venv \
python3.11-dev \
python3-pip \
&& ln -sf /usr/bin/python3.11 /usr/bin/python3 \
&& ln -sf /usr/bin/python3.11 /usr/bin/python \
&& python3.11 -m pip install --upgrade pip \
&& apt-get remove -y python3-blinker || true \
&& rm -rf /var/lib/apt/lists/*
# Fix security policy for ImageMagick
RUN sed -i '/<policy domain="path" rights="none" pattern="@\*"/d' /etc/ImageMagick-6/policy.xml
# Copy only the requirements.txt first to leverage Docker cache
COPY requirements.txt ./
# Install Python dependencies
RUN python3 -m pip install --no-cache-dir \
-i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com \
--retries 3 --timeout 60 -r requirements.txt || \
python3 -m pip install --no-cache-dir \
-i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/ --trusted-host mirrors.tuna.tsinghua.edu.cn \
--retries 3 --timeout 60 -r requirements.txt || \
python3 -m pip install --no-cache-dir \
--retries 3 --timeout 60 -r requirements.txt
# Now copy the rest of the codebase into the image
COPY . .
# Expose the port the app runs on
EXPOSE 8501
# Command to run the application
CMD ["streamlit", "run", "./webui/Main.py","--browser.serverAddress=127.0.0.1","--server.enableCORS=True","--browser.gatherUsageStats=False"]