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
|
# Set the working directory in the container
|
||||||
WORKDIR /MoneyPrinterTurbo
|
WORKDIR /MoneyPrinterTurbo
|
||||||
|
|
||||||
ENV PYTHONPATH="/MoneyPrinterTurbo:$PYTHONPATH"
|
ENV PYTHONPATH="/MoneyPrinterTurbo"
|
||||||
|
|
||||||
# Install system dependencies
|
# Install system dependencies
|
||||||
RUN apt-get update && apt-get install -y \
|
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
|
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 the current directory contents into the container at /MoneyPrinterTurbo
|
||||||
COPY ./app ./app
|
COPY . .
|
||||||
COPY ./webui ./webui
|
|
||||||
COPY ./resource ./resource
|
|
||||||
COPY ./requirements.txt ./requirements.txt
|
|
||||||
COPY ./main.py ./main.py
|
|
||||||
|
|
||||||
# Install Python dependencies
|
# Install Python dependencies
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
@@ -30,8 +26,13 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|||||||
EXPOSE 8501
|
EXPOSE 8501
|
||||||
|
|
||||||
# Command to run the application
|
# 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
|
# 1. Build the Docker image using the following command
|
||||||
# using Docker volumes. Example usage:
|
# docker build -t moneyprinterturbo .
|
||||||
# docker run -v ./config.toml:/MoneyPrinterTurbo/config.toml -v ./storage:/MoneyPrinterTurbo/storage -p 8501:8501 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"
|
version: "3"
|
||||||
|
|
||||||
x-common-volumes: &common-volumes
|
x-common-volumes: &common-volumes
|
||||||
- ./config.toml:/MoneyPrinterTurbo/config.toml
|
- ./:/MoneyPrinterTurbo
|
||||||
- ./storage:/MoneyPrinterTurbo/storage
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
webui:
|
webui:
|
||||||
@@ -12,7 +11,7 @@ services:
|
|||||||
container_name: "webui"
|
container_name: "webui"
|
||||||
ports:
|
ports:
|
||||||
- "8501:8501"
|
- "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
|
volumes: *common-volumes
|
||||||
restart: always
|
restart: always
|
||||||
api:
|
api:
|
||||||
|
|||||||
Reference in New Issue
Block a user