Files

44 lines
1.5 KiB
Docker
Raw Permalink Normal View History

2024-04-02 11:03:29 +08:00
# Use an official Python runtime as a parent image
2024-12-05 10:34:09 +08:00
FROM python:3.11-slim-bullseye
2024-04-02 11:03:29 +08:00
# Set the working directory in the container
2024-04-03 14:13:54 +08:00
WORKDIR /MoneyPrinterTurbo
2024-04-24 13:47:37 +08:00
# 设置/MoneyPrinterTurbo目录权限为777
RUN chmod 777 /MoneyPrinterTurbo
2024-04-11 13:40:02 +08:00
ENV PYTHONPATH="/MoneyPrinterTurbo"
2024-04-02 11:03:29 +08:00
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
imagemagick \
2024-04-03 14:13:54 +08:00
ffmpeg \
2024-04-02 11:03:29 +08:00
&& 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
2024-04-17 16:01:45 +08:00
# Copy only the requirements.txt first to leverage Docker cache
COPY requirements.txt ./
2024-04-02 11:03:29 +08:00
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
2024-04-17 16:01:45 +08:00
# Now copy the rest of the codebase into the image
COPY . .
2024-04-02 11:03:29 +08:00
# Expose the port the app runs on
2024-04-03 14:13:54 +08:00
EXPOSE 8501
2024-04-02 11:03:29 +08:00
# Command to run the application
2024-04-11 13:40:02 +08:00
CMD ["streamlit", "run", "./webui/Main.py","--browser.serverAddress=127.0.0.1","--server.enableCORS=True","--browser.gatherUsageStats=False"]
2024-04-02 11:03:29 +08:00
2024-04-11 13:40:02 +08:00
# 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:
2025-03-09 00:23:55 +01:00
# docker run -v ${PWD}/config.toml:/MoneyPrinterTurbo/config.toml -v ${PWD}/storage:/MoneyPrinterTurbo/storage -p 8501:8501 moneyprinterturbo