Hello, I'm having an issue with my Dockerfile and start.sh script. At the end of my Dockerfile, I have ENTRYPOINT ["./start.sh"] which runs the start.sh script. This script starts the comfyui server and then runs rp_handler at the end.
When the API is called for the first time, the docker image initializes and the start.sh script successfully starts the comfyui server. However, on the second API call, it seems to skip the contents of start.sh and directly runs rp_handler.py, causing issues.
Here's the content of my start.sh file:
#!/usr/bin/env bash
echo "Worker Initiated"
echo "Symlinking files from Network Volume"
if [ -L "/workspace/ComfyUI" ]; then
echo "/workspace/ComfyUI is already a symlink"
else
ln -s /runpod-volume/ComfyUI /workspace
fi
if [ -L "/workspace/comfyui-venv" ]; then
echo "/workspace/comfyui-venv is already a symlink"
else
ln -s /runpod-volume/comfyui-venv /workspace
fi
echo "Starting ComfyUI API"
if [ -d "comfyui-venv" ]; then
echo "Virtual environment directory exists"
else
echo "Virtual environment directory does not exist"
exit 1
fi
if [ -f "comfyui-venv/bin/activate" ]; then
echo "Activate script exists"
else
echo "Activate script does not exist"
exit 1
fi
source comfyui-venv/bin/activate
if [[ $VIRTUAL_ENV == "/workspace/comfyui-venv" ]]; then
echo "Virtual environment activated successfully"
else
echo "Failed to activate virtual environment"
echo "Content of the activate script:"
cat comfyui-venv/bin/activate
exit 1
fi
export HF_HOME="/workspace"
cd /workspace/ComfyUI && python main.py --port 3000 &
deactivate
echo "Starting RunPod Handler"
python -u /workspace/rp_handler.py