Dockerfile optimization
This commit is contained in:
parent
bae41bd34b
commit
bc25f506be
|
|
@ -4,11 +4,10 @@ FROM python:3.12-slim-bullseye
|
|||
WORKDIR /app
|
||||
|
||||
ARG GIT_BRANCH=unknown GIT_REVISION=unknown DATE=unknown TARGET_ARCH='amd'
|
||||
ENV UID=1000 GID=1000 GIT_BRANCH=$GIT_BRANCH GIT_REVISION=$GIT_REVISION DATE=$DATE NB_WORKERS=5 LOG_LEVEL="info" DISABLE_REDIS='false' TARGET_ARCH=$TARGET_ARCH
|
||||
ENV UID=1000 GID=1000 GIT_BRANCH=$GIT_BRANCH GIT_REVISION=$GIT_REVISION DATE=$DATE NB_WORKERS=5 LOG_LEVEL="info" DISABLE_REDIS='false' TARGET_ARCH=$TARGET_ARCH BREAKING_CHANGES_VERSION=0
|
||||
VOLUME ["/app/params", "/app/data", "/app/downloads", "/app/logs"]
|
||||
EXPOSE 80
|
||||
|
||||
RUN pip install static-ffmpeg && static_ffmpeg; ln -s /usr/local/lib/python3.12/site-packages/static_ffmpeg/bin/linux/ffmpeg /usr/bin/ffmpeg
|
||||
RUN if [ "$TARGET_ARCH" = "arm" ] ; then apt install gcc python3-dev -y && apt-get autoremove && apt-get -y clean && rm -rf /var/lib/apt/lists/*; fi
|
||||
|
||||
COPY --chmod=755 entrypoint.sh ./
|
||||
|
|
@ -16,6 +15,4 @@ COPY *.py pip_requirements_$TARGET_ARCH ./
|
|||
COPY params/*.py params/*.ini params/userscript.js params/hooks_requirements ./setup/
|
||||
COPY params/params_docker.ini ./setup/params.ini
|
||||
|
||||
RUN pip3 install -r pip_requirements_$TARGET_ARCH
|
||||
|
||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
|
|
|
|||
|
|
@ -41,10 +41,28 @@ else
|
|||
pip3 install --disable-pip-version-check -q --root-user-action=ignore yt-dlp==$FORCE_YTDLP_VERSION --force-reinstall
|
||||
fi
|
||||
|
||||
if [ -e /app/params/hooks_requirements ]; then
|
||||
pip3 install --disable-pip-version-check -q --root-user-action=ignore -r /app/params/hooks_requirements
|
||||
else
|
||||
pip3 install --disable-pip-version-check -q --root-user-action=ignore -r /app/setup/hooks_requirements
|
||||
breaking_changes=$(cat BREAKING_CHANGES_VERSION 2> /dev/null)
|
||||
|
||||
# If BREAKING_CHANGES_VERSION not present or different from dockerfile, it means it's the container init. Install all dependencies
|
||||
if [ ! -e BREAKING_CHANGES_VERSION ] || [ ! $breaking_changes -eq "$BREAKING_CHANGES_VERSION" ]; then
|
||||
echo --- Installing ydl_api_ng requirements ---
|
||||
pip3 install --disable-pip-version-check -q --root-user-action=ignore -r pip_requirements_$TARGET_ARCH
|
||||
|
||||
# Execute once to download the real ffmpeg binaries
|
||||
echo --- Setup ffmpeg ---
|
||||
2>/dev/null 1>&2 /usr/local/bin/static_ffmpeg
|
||||
rm -f /usr/bin/ffmpeg /usr/bin/ffprobe
|
||||
ln -s /usr/local/lib/python3.12/site-packages/static_ffmpeg/bin/linux/ffmpeg /usr/bin/ffmpeg
|
||||
ln -s /usr/local/lib/python3.12/site-packages/static_ffmpeg/bin/linux/ffprobe /usr/bin/ffprobe
|
||||
|
||||
echo --- Installing hooks requirements ---
|
||||
if [ -e /app/params/hooks_requirements ]; then
|
||||
pip3 install --disable-pip-version-check -q --root-user-action=ignore -r /app/params/hooks_requirements
|
||||
else
|
||||
pip3 install --disable-pip-version-check -q --root-user-action=ignore -r /app/setup/hooks_requirements
|
||||
fi
|
||||
|
||||
echo "$BREAKING_CHANGES_VERSION" > BREAKING_CHANGES_VERSION
|
||||
fi
|
||||
|
||||
if [ "$DISABLE_REDIS" == "false" ]; then
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
cronsim
|
||||
fastapi
|
||||
yt-dlp
|
||||
uvicorn
|
||||
psutil
|
||||
ffmpeg-python
|
||||
humanize
|
||||
requests
|
||||
mergedeep
|
||||
psutil
|
||||
redis
|
||||
requests
|
||||
rq
|
||||
static-ffmpeg
|
||||
supervisor
|
||||
tinydb
|
||||
cronsim
|
||||
ffmpeg-python
|
||||
mergedeep
|
||||
uvicorn
|
||||
yt-dlp
|
||||
|
|
@ -1,13 +1,14 @@
|
|||
cronsim
|
||||
fastapi==0.110.2
|
||||
yt-dlp
|
||||
uvicorn
|
||||
psutil
|
||||
ffmpeg-python
|
||||
humanize
|
||||
requests
|
||||
mergedeep
|
||||
psutil
|
||||
redis
|
||||
requests
|
||||
rq
|
||||
static-ffmpeg
|
||||
supervisor
|
||||
tinydb
|
||||
cronsim
|
||||
ffmpeg-python
|
||||
mergedeep
|
||||
uvicorn
|
||||
yt-dlp
|
||||
Loading…
Reference in New Issue