Update code, add run.bat

This commit is contained in:
Sasser7 2024-11-28 21:53:13 +01:00
parent 6182fec501
commit f139294aaf
2 changed files with 42 additions and 0 deletions

View File

@ -4,6 +4,7 @@ EXPOSE 8188
# Copy the repo and install required dependencies
WORKDIR /ComfyUI
COPY . .
RUN apt update && apt install git -y
RUN pip install --no-cache-dir -r requirements.txt
# ComfyUI entrypoint

41
run.bat Normal file
View File

@ -0,0 +1,41 @@
@echo off
:: Set default port and read from .env if exists
set "port=8188"
for /f "tokens=2 delims==" %%i in ('findstr /r "^PORT=" .env') do set "port=%%i"
:: Set default venv path and read from .env if exists
set "venv_path="
for /f "tokens=2 delims==" %%i in ('findstr /r "^VENV_PATH=" .env') do set "venv_path=%%i"
:: Activate the virtual environment if specified
if not "%venv_path%"=="" (
call "%venv_path%\Scripts\activate"
echo Activated virtual environment: %venv_path%
) else (
echo No virtual environment specified. Using system Python.
)
:: Pull updates and handle local changes
:pull
set "cmdOutput=cmd_output.txt"
git pull > "%cmdOutput%" 2>&1
:: Handle potential conflicts or changes
findstr /C:"error: Your local changes to the following files would be overwritten by merge:" "%cmdOutput%" > nul && (
echo Pull conflicts detected. Stashing changes...
git stash
git pull
)
findstr /C:"Already up to date." "%cmdOutput%" > nul || goto rebuild
del "%cmdOutput%"
echo No changes detected. Starting ComfyUI
pip install -r requirements.txt
echo Opening localhost:%port% in your default browser...
start http://localhost:%port%
python main.py