From 22614f05e215d7a448aab16f2013fb4273b8e4ec Mon Sep 17 00:00:00 2001 From: tcsenpai Date: Sat, 26 Oct 2024 19:22:08 +0200 Subject: [PATCH] added some control --- Dockerfile | 5 +++++ README.md | 4 ++++ app/entrypoint.sh | 6 ++++++ app/pre_run.sh | 6 ++++++ 4 files changed, 21 insertions(+) create mode 100644 app/pre_run.sh diff --git a/Dockerfile b/Dockerfile index a4b51b6..9ab3db1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,11 @@ RUN apt-get install -y bash # Install dos2unix RUN apt-get install -y dos2unix +# Install libgl1-mesa-glx +# NOTE This is needed for some extensions and will save a lot of headaches later +RUN apt-get install -y libgl1-mesa-glx libglib2.0-0 + + # Install pip requirements #COPY app/automatic/requirements.txt . #RUN pip install -r requirements.txt diff --git a/README.md b/README.md index f080366..4bfed0b 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,10 @@ You can also: The container mounts the app/automatic_repo folder as a volume, so you can add models and other files to it. After the first run, you will find the folder under app/automatic_repo. +## Pre-run script + +You can add a pre_run.sh file to the app folder, and it will be run on startup. This can be used to install dependencies for python in case something is missing. + ## Run ``` diff --git a/app/entrypoint.sh b/app/entrypoint.sh index b781ac8..88d8a6c 100644 --- a/app/entrypoint.sh +++ b/app/entrypoint.sh @@ -1,5 +1,10 @@ #!/bin/bash +# If a file named "pre_run.sh" exists, run it +if [ -f "pre_run.sh" ]; then + ./pre_run.sh +fi + # If no folder named automatic, clone the repository if [ ! -d "automatic_repo" ]; then git clone https://github.com/vladmandic/automatic automatic_repo @@ -9,5 +14,6 @@ else git pull fi + #pip install -r requirements.txt bash webui.sh --debug --insecure --listen \ No newline at end of file diff --git a/app/pre_run.sh b/app/pre_run.sh new file mode 100644 index 0000000..812f0fc --- /dev/null +++ b/app/pre_run.sh @@ -0,0 +1,6 @@ +#! /bin/bash +echo "== Pre-run script ==" + +# You can add any commands you want to run here +# For example: +# apt-get install -y libgl1-mesa-glx libglib2.0-0 \ No newline at end of file