MoneyPrinterTurbo/Dockerfile
hunkjun af458ca2c9
修改基础镜像的apt源
内网环境很容易出现: 
#6 0.350 Err:1 http://deb.debian.org/debian bullseye InRelease
#6 0.350   Connection failed [IP: 151.101.110.132 80]
#6 0.353 Err:2 http://deb.debian.org/debian-security bullseye-security InRelease
#6 0.353   Connection failed [IP: 151.101.110.132 80]
#6 0.356 Err:3 http://deb.debian.org/debian bullseye-updates InRelease
#6 0.356   Connection failed [IP: 151.101.110.132 80]
2024-05-31 14:17:18 +08:00

50 lines
1.8 KiB
Docker

# Use an official Python runtime as a parent image
FROM python:3.10-slim-bullseye
# Set the working directory in the container
WORKDIR /MoneyPrinterTurbo
# 设置/MoneyPrinterTurbo目录权限为777
RUN chmod 777 /MoneyPrinterTurbo
ENV PYTHONPATH="/MoneyPrinterTurbo"
# 改成国内的镜像, 避免连不上: deb.debian.org
RUN echo "deb http://mirrors.aliyun.com/debian/ bullseye main" > /etc/apt/sources.list && \
echo "deb http://mirrors.aliyun.com/debian-security/ bullseye-security main" >> /etc/apt/sources.list && \
echo "deb http://mirrors.aliyun.com/debian/ bullseye-updates main" >> /etc/apt/sources.list
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
imagemagick \
ffmpeg \
&& 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 pip install --no-cache-dir -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"]
# 1. Build the Docker image using the following command
# docker build -t moneyprinterturbo .
# 2. Run the Docker container using the following command
## For Linux or MacOS:
# docker run -v $(pwd)/config.toml:/MoneyPrinterTurbo/config.toml -v $(pwd)/storage:/MoneyPrinterTurbo/storage -p 8501:8501 moneyprinterturbo
## For Windows:
# docker run -v %cd%/config.toml:/MoneyPrinterTurbo/config.toml -v %cd%/storage:/MoneyPrinterTurbo/storage -p 8501:8501 moneyprinterturbo