mirror of
https://github.com/harry0703/MoneyPrinterTurbo.git
synced 2025-11-25 11:29:36 +08:00
optimize dockerfile
This commit is contained in:
21
Dockerfile
21
Dockerfile
@@ -4,7 +4,7 @@ FROM python:3.10-slim
|
||||
# Set the working directory in the container
|
||||
WORKDIR /MoneyPrinterTurbo
|
||||
|
||||
ENV PYTHONPATH="/MoneyPrinterTurbo:$PYTHONPATH"
|
||||
ENV PYTHONPATH="/MoneyPrinterTurbo"
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
@@ -17,11 +17,7 @@ RUN apt-get update && apt-get install -y \
|
||||
RUN sed -i '/<policy domain="path" rights="none" pattern="@\*"/d' /etc/ImageMagick-6/policy.xml
|
||||
|
||||
# Copy the current directory contents into the container at /MoneyPrinterTurbo
|
||||
COPY ./app ./app
|
||||
COPY ./webui ./webui
|
||||
COPY ./resource ./resource
|
||||
COPY ./requirements.txt ./requirements.txt
|
||||
COPY ./main.py ./main.py
|
||||
COPY . .
|
||||
|
||||
# Install Python dependencies
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
@@ -30,8 +26,13 @@ RUN pip install --no-cache-dir -r requirements.txt
|
||||
EXPOSE 8501
|
||||
|
||||
# Command to run the application
|
||||
CMD ["streamlit", "run", "./webui/Main.py","--browser.serverAddress=0.0.0.0","--server.enableCORS=True","--browser.gatherUsageStats=False"]
|
||||
CMD ["streamlit", "run", "./webui/Main.py","--browser.serverAddress=127.0.0.1","--server.enableCORS=True","--browser.gatherUsageStats=False"]
|
||||
|
||||
# At runtime, mount the config.toml file from the host into the container
|
||||
# using Docker volumes. Example usage:
|
||||
# docker run -v ./config.toml:/MoneyPrinterTurbo/config.toml -v ./storage:/MoneyPrinterTurbo/storage -p 8501:8501 moneyprinterturbo
|
||||
# 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
|
||||
@@ -1,8 +1,7 @@
|
||||
version: "3"
|
||||
|
||||
x-common-volumes: &common-volumes
|
||||
- ./config.toml:/MoneyPrinterTurbo/config.toml
|
||||
- ./storage:/MoneyPrinterTurbo/storage
|
||||
- ./:/MoneyPrinterTurbo
|
||||
|
||||
services:
|
||||
webui:
|
||||
@@ -12,7 +11,7 @@ services:
|
||||
container_name: "webui"
|
||||
ports:
|
||||
- "8501:8501"
|
||||
command: ["streamlit", "run", "./webui/Main.py","--browser.serverAddress=0.0.0.0","--server.enableCORS=True","--browser.gatherUsageStats=False"]
|
||||
command: [ "streamlit", "run", "./webui/Main.py","--browser.serverAddress=127.0.0.1","--server.enableCORS=True","--browser.gatherUsageStats=False" ]
|
||||
volumes: *common-volumes
|
||||
restart: always
|
||||
api:
|
||||
|
||||
Reference in New Issue
Block a user