McCloudS / subgen

Autogenerate subtitles using OpenAI Whisper Model via Jellyfin, Plex, Emby, Tautulli, or Bazarr
MIT License
532 stars 48 forks source link

Fix container startup failure due to CMD path error #32

Closed Rikiar73574 closed 8 months ago

Rikiar73574 commented 8 months ago

Just something that was giving me issues in running this, both from the image and building my own image.

i was getting error "/subgen/./subgen.py no such file or directory" changing this to "/subgen/subgen.py" fixed it.

McCloudS commented 8 months ago

Odd…the WORKDIR command should set the directory correctly before CMD runs.

https://github.com/McCloudS/subgen/blob/fb438d92703730bedaca710ac5f5b7932becb499/Dockerfile#L3

Rikiar73574 commented 8 months ago

yeah i also thought so but hardcoding that "./" apparently does not work as intended and this appears to cause issues also with the image version of it, have you had a chance to test it? this has fixed it for me in the meantime.

McCloudS commented 8 months ago

I exclusively use the image and haven’t had any problems. Shouldn’t it be CMD [ "python3", "-u", "/subgen/subgen.py" ]

Rikiar73574 commented 8 months ago

could you share your compose? i'll spin it up clean and share the log.

EDIT: i tried the compose in the repo and it works, the issue seems only to be from the dockerfile maybe?

McCloudS commented 8 months ago

I'm using the Dockerfile via unRaid, which isn't using Docker-compose. No issues here.

Rikiar73574 commented 8 months ago

definetely odd then, i'll try to reproduce it just in case.

Rikiar73574 commented 8 months ago

I'll close this, and just call it it do be like that sometimes. now it's not doing anymore, no idea why i had to struggle with it all morning.

Rikiar73574 commented 8 months ago

Ok i managed to reproduce it,

docker build . -f Dockerfile.cuda
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
            Install the buildx component to build images with BuildKit:
            https://docs.docker.com/go/buildx/

Sending build context to Docker daemon  429.1kB
Step 1/7 : FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
 ---> 2d49de6afba5
Step 2/7 : WORKDIR /subgen
 ---> Using cache
 ---> 05c09f87a1a0
Step 3/7 : RUN apt-get update && apt-get -y install python3 python3-pip ffmpeg
 ---> Using cache
 ---> f051992230bd
Step 4/7 : ENV PYTHONUNBUFFERED 1
 ---> Using cache
 ---> a7bfbb9d1394
Step 5/7 : ADD https://raw.githubusercontent.com/McCloudS/subgen/main/subgen/subgen.py /subgen/subgen.py
Downloading  19.28kB
 ---> Using cache
 ---> 38d0b6d2a574
Step 6/7 : CMD [ "python3", "-u", "./subgen.py" ]
 ---> Running in 09a8c3219a8b
Removing intermediate container 09a8c3219a8b
 ---> 45098d546f54
Step 7/7 : EXPOSE 8090
 ---> Running in 48b98f9f2adb
^[[ARemoving intermediate container 48b98f9f2adb
 ---> 9e20e0ed504a
Successfully built 9e20e0ed504a

builds succesfully with the workdir as indicated, then if i try to run it with the same command i used for "subgen/subgen.py" it throws out

python3: can't open file '/subgen/./subgen.py': [Errno 2] No such file or directory

docker run --gpus all -d \
  --name subgen-container-cuda \
  --network proxy \
  -p 8091:8091 \
  -v /mnt/docker/data/media/tv:/tv \
  -v /mnt/docker/data/media/movies:/movies \
  -v /mnt/docker-config/subgen:/subgen \
  -v /mnt/docker-config/subgen/dist-packages:/subgen/dist-package \
  -e WHISPER_MODEL=medium \
  -e WHISPER_THREADS=4 \
  -e PROCADDEDMEDIA=True \
  -e PROCMEDIAONPLAY=True \
  -e NAMESUBLANG=aa \
  -e SKIPIFINTERNALSUBLANG=pol \
  -e PLEXTOKEN=XXXXX \
  -e PLEXSERVER=http://plex:32400 \
  -e JELLYFINTOKEN=token\ here \
  -e JELLYFINSERVER=http://jellyfin:8096 \
  -e WEBHOOKPORT=8091 \
  -e CONCURRENT_TRANSCRIPTIONS=2 \
  -e WORD_LEVEL_HIGHLIGHT=False \
  -e DEBUG=False \
  -e USE_PATH_MAPPING=False \
  -e PATH_MAPPING_FROM=/tv \
  -e PATH_MAPPING_TO=/Volumes/TV \
  -e TRANSCRIBE_DEVICE=gpu \
  9e20e0ed504a

any ideas? p.s.: i'll keep the branch closed since no idea if this is even that common.

McCloudS commented 8 months ago

Maybe…It could be this volume config:

/mnt/docker-config/subgen:/subgen

If you don’t have subgen.py in /mnt/docker-config/subgen, it’ll fail. I would only recommend using that volume to make rapid changes to the script in a dev environment.

Alternative is placing the script in that volume location manually, it just won’t get updates from the repo on image updates.

On Mon, Dec 18, 2023 at 5:54 PM Rikiar @.***> wrote:

Ok i managed to reproduce it,

docker build . -f Dockerfile.cuda DEPRECATED: The legacy builder is deprecated and will be removed in a future release. Install the buildx component to build images with BuildKit: https://docs.docker.com/go/buildx/

Sending build context to Docker daemon 429.1kB Step 1/7 : FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 ---> 2d49de6afba5 Step 2/7 : WORKDIR /subgen ---> Using cache ---> 05c09f87a1a0 Step 3/7 : RUN apt-get update && apt-get -y install python3 python3-pip ffmpeg ---> Using cache ---> f051992230bd Step 4/7 : ENV PYTHONUNBUFFERED 1 ---> Using cache ---> a7bfbb9d1394 Step 5/7 : ADD https://raw.githubusercontent.com/McCloudS/subgen/main/subgen/subgen.py /subgen/subgen.py Downloading 19.28kB ---> Using cache ---> 38d0b6d2a574 Step 6/7 : CMD [ "python3", "-u", "./subgen.py" ] ---> Running in 09a8c3219a8b Removing intermediate container 09a8c3219a8b ---> 45098d546f54 Step 7/7 : EXPOSE 8090 ---> Running in 48b98f9f2adb ^[[ARemoving intermediate container 48b98f9f2adb ---> 9e20e0ed504a Successfully built 9e20e0ed504a

builds succesfully with the workdir as indicated, then if i try to run it with the same command i used for "subgen/subgen.py" it throws out

python3: can't open file '/subgen/./subgen.py': [Errno 2] No such file or directory

docker run --gpus all -d \ --name subgen-container-cuda \ --network proxy \ -p 8091:8091 \ -v /mnt/docker/data/media/tv:/tv \ -v /mnt/docker/data/media/movies:/movies \ -v /mnt/docker-config/subgen:/subgen \ -v /mnt/docker-config/subgen/dist-packages:/subgen/dist-package \ -e WHISPER_MODEL=medium \ -e WHISPER_THREADS=4 \ -e PROCADDEDMEDIA=True \ -e PROCMEDIAONPLAY=True \ -e NAMESUBLANG=aa \ -e SKIPIFINTERNALSUBLANG=pol \ -e PLEXTOKEN=XXXXX \ -e PLEXSERVER=http://plex:32400 \ -e JELLYFINTOKEN=token\ here \ -e JELLYFINSERVER=http://jellyfin:8096 \ -e WEBHOOKPORT=8091 \ -e CONCURRENT_TRANSCRIPTIONS=2 \ -e WORD_LEVEL_HIGHLIGHT=False \ -e DEBUG=False \ -e USE_PATH_MAPPING=False \ -e PATH_MAPPING_FROM=/tv \ -e PATH_MAPPING_TO=/Volumes/TV \ -e TRANSCRIBE_DEVICE=gpu \ 9e20e0ed504a

any ideas?

— Reply to this email directly, view it on GitHub https://github.com/McCloudS/subgen/pull/32#issuecomment-1861927750, or unsubscribe https://github.com/notifications/unsubscribe-auth/APJACQJPDMLS2MKF3K5NSWLYKDQUZAVCNFSM6AAAAABAZWJ56KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRRHEZDONZVGA . You are receiving this because you commented.Message ID: @.***>

Rikiar73574 commented 8 months ago

Yup, straight on.

in your example compose there's also that volume so i just copied it over in my command, when i tested i a few comments ago i tried it with no volumes so that's why it worked, might be better to just remove it from the example compose maybe? not like your common user is gonna poke in the script.

EDIT: oh and since i did git clone i guess it should also be /mnt/docker-config/subgen/subgen:/subgen , this also works