mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-27 09:26:36 +00:00
More fixes from testing for download_expected_file
- Used download_expected_file for ffmpeg also - Updated to a ffmpeg version that could be downloaded - Optimized tar extraction for ffmpeg - Preserved the original `/root` using a copy in `/tmp` instead - DRY'd the file name and expected / URL values
This commit is contained in:
parent
8885571c5a
commit
83f2831439
68
Dockerfile
68
Dockerfile
@ -1,6 +1,6 @@
|
|||||||
FROM debian:bookworm-slim
|
FROM debian:bookworm-slim
|
||||||
|
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH=amd64
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
|
|
||||||
ARG S6_VERSION="3.2.0.0"
|
ARG S6_VERSION="3.2.0.0"
|
||||||
@ -8,8 +8,10 @@ ARG SHA256_S6_AMD64="ad982a801bd72757c7b1b53539a146cf715e640b4d8f0a6a671a3d1b560
|
|||||||
ARG SHA256_S6_ARM64="868973e98210257bba725ff5b17aa092008c9a8e5174499e38ba611a8fc7e473"
|
ARG SHA256_S6_ARM64="868973e98210257bba725ff5b17aa092008c9a8e5174499e38ba611a8fc7e473"
|
||||||
ARG SHA256_S6_NOARCH="4b0c0907e6762814c31850e0e6c6762c385571d4656eb8725852b0b1586713b6"
|
ARG SHA256_S6_NOARCH="4b0c0907e6762814c31850e0e6c6762c385571d4656eb8725852b0b1586713b6"
|
||||||
|
|
||||||
ARG FFMPEG_DATE="autobuild-2024-10-30-14-17"
|
ARG FFMPEG_DATE="autobuild-2024-10-31-14-17"
|
||||||
ARG FFMPEG_VERSION="117674-g44a0a0c050"
|
ARG FFMPEG_VERSION="117676-g87068b9600"
|
||||||
|
ARG SHA256_FFMPEG_AMD64="841c5d93d96d376be12f74db8f091b1f29fd73d59da44ff09c2eb44dbdabe273"
|
||||||
|
ARG SHA256_FFMPEG_ARM64="8546beda0132483b3ed6be24abbd92b20a1af51ba28daf34860adeb27b60140e"
|
||||||
|
|
||||||
ENV S6_VERSION="${S6_VERSION}" \
|
ENV S6_VERSION="${S6_VERSION}" \
|
||||||
FFMPEG_DATE="${FFMPEG_DATE}" \
|
FFMPEG_DATE="${FFMPEG_DATE}" \
|
||||||
@ -33,6 +35,10 @@ RUN decide_arch() { \
|
|||||||
} && \
|
} && \
|
||||||
decide_expected() { \
|
decide_expected() { \
|
||||||
case "${1}" in \
|
case "${1}" in \
|
||||||
|
(ffmpeg) case "${2}" in \
|
||||||
|
(amd64) printf -- '%s' "${SHA256_FFMPEG_AMD64}" ;; \
|
||||||
|
(arm64) printf -- '%s' "${SHA256_FFMPEG_ARM64}" ;; \
|
||||||
|
esac ;; \
|
||||||
(s6) case "${2}" in \
|
(s6) case "${2}" in \
|
||||||
(amd64) printf -- '%s' "${SHA256_S6_AMD64}" ;; \
|
(amd64) printf -- '%s' "${SHA256_S6_AMD64}" ;; \
|
||||||
(arm64) printf -- '%s' "${SHA256_S6_ARM64}" ;; \
|
(arm64) printf -- '%s' "${SHA256_S6_ARM64}" ;; \
|
||||||
@ -42,6 +48,14 @@ RUN decide_arch() { \
|
|||||||
} && \
|
} && \
|
||||||
decide_url() { \
|
decide_url() { \
|
||||||
case "${1}" in \
|
case "${1}" in \
|
||||||
|
(ffmpeg) printf -- \
|
||||||
|
'https://github.com/yt-dlp/FFmpeg-Builds/releases/download/%s/ffmpeg-N-%s-linux%s-gpl.tar.xz' \
|
||||||
|
"${FFMPEG_DATE}" \
|
||||||
|
"${FFMPEG_VERSION}" \
|
||||||
|
"$(case "${2}" in \
|
||||||
|
(amd64) printf -- '64' ;; \
|
||||||
|
(*) printf -- '%s' "${2}" ;; \
|
||||||
|
esac)" ;; \
|
||||||
(s6) printf -- \
|
(s6) printf -- \
|
||||||
'https://github.com/just-containers/s6-overlay/releases/download/v%s/s6-overlay-%s.tar.xz' \
|
'https://github.com/just-containers/s6-overlay/releases/download/v%s/s6-overlay-%s.tar.xz' \
|
||||||
"${S6_VERSION}" \
|
"${S6_VERSION}" \
|
||||||
@ -60,20 +74,17 @@ RUN decide_arch() { \
|
|||||||
done ; \
|
done ; \
|
||||||
} && \
|
} && \
|
||||||
download_expected_file() { \
|
download_expected_file() { \
|
||||||
|
local arg1 expected file url ; \
|
||||||
|
arg1="$(printf -- '%s\n' "${1}" | awk '{print toupper($0);}')" ; \
|
||||||
|
expected="$(decide_expected "${1}" "${2}")" ; \
|
||||||
|
file="${3}" ; \
|
||||||
|
url="$(decide_url "${1}" "${2}")" ; \
|
||||||
printf -- '%s\n' \
|
printf -- '%s\n' \
|
||||||
"Building for arch: ${2}|${ARCH}, downloading ${1} from: $(decide_url "${1}" "${2}"), expecting ${1} SHA256: $(decide_expected "${1}" "${2}")" && \
|
"Building for arch: ${2}|${ARCH}, downloading ${arg1} from: ${url}, expecting ${arg1} SHA256: ${expected}" && \
|
||||||
curl -sSL --output "${3}" "$(decide_url "${1}" "${2}")" && \
|
curl -sSL --output "${file}" "${url}" && \
|
||||||
verify_download "$(decide_expected "${1}" "${2}")" "${3}" ; \
|
verify_download "${expected}" "${file}" ; \
|
||||||
} && \
|
} && \
|
||||||
export ARCH="$(decide_arch)" && \
|
export ARCH="$(decide_arch)" && \
|
||||||
export FFMPEG_EXPECTED_SHA256=$(case ${TARGETPLATFORM:-linux/amd64} in \
|
|
||||||
"linux/amd64") echo "08f889687ca9706171c2b534ff241e0e1fda082f27f2ddd9fedf14a8e7b5f1aa" ;; \
|
|
||||||
"linux/arm64") echo "a2ea26c54b1c79b63a6b51b5c228b6a350fe790c4c75e5d0889636b37e2e694b" ;; \
|
|
||||||
*) echo "" ;; esac) && \
|
|
||||||
export FFMPEG_DOWNLOAD=$(case ${TARGETPLATFORM:-linux/amd64} in \
|
|
||||||
"linux/amd64") echo "https://github.com/yt-dlp/FFmpeg-Builds/releases/download/${FFMPEG_DATE}/ffmpeg-N-${FFMPEG_VERSION}-linux64-gpl.tar.xz" ;; \
|
|
||||||
"linux/arm64") echo "https://github.com/yt-dlp/FFmpeg-Builds/releases/download/${FFMPEG_DATE}/ffmpeg-N-${FFMPEG_VERSION}-linuxarm64-gpl.tar.xz" ;; \
|
|
||||||
*) echo "" ;; esac) && \
|
|
||||||
set -x && \
|
set -x && \
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get -y --no-install-recommends install locales && \
|
apt-get -y --no-install-recommends install locales && \
|
||||||
@ -82,20 +93,17 @@ RUN decide_arch() { \
|
|||||||
# Install required distro packages
|
# Install required distro packages
|
||||||
apt-get -y --no-install-recommends install curl ca-certificates binutils xz-utils && \
|
apt-get -y --no-install-recommends install curl ca-certificates binutils xz-utils && \
|
||||||
# Install s6
|
# Install s6
|
||||||
download_expected_file s6 noarch "/tmp/s6-overlay-noarch.tar.xz" && \
|
_file="/tmp/s6-overlay-noarch.tar.xz" && \
|
||||||
tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz && \
|
download_expected_file s6 noarch "${_file}" && \
|
||||||
download_expected_file s6 "${TARGETARCH}" "/tmp/s6-overlay-${ARCH}.tar.xz" \
|
tar -C / -xpf "${_file}" && rm -f "${_file}" && \
|
||||||
tar -C / -Jxpf /tmp/s6-overlay-${ARCH}.tar.xz && \
|
_file="/tmp/s6-overlay-${ARCH}.tar.xz" && \
|
||||||
|
download_expected_file s6 "${TARGETARCH}" "${_file}" && \
|
||||||
|
tar -C / -xpf "${_file}" && rm -f "${_file}" && \
|
||||||
# Install ffmpeg
|
# Install ffmpeg
|
||||||
echo "Building for arch: ${ARCH}|${ARCH44}, downloading FFMPEG from: ${FFMPEG_DOWNLOAD}, expecting FFMPEG SHA256: ${FFMPEG_EXPECTED_SHA256}" && \
|
_file="/tmp/ffmpeg-${ARCH}.tar.xz" && \
|
||||||
curl -L ${FFMPEG_DOWNLOAD} --output /tmp/ffmpeg-${ARCH}.tar.xz && \
|
download_expected_file ffmpeg "${TARGETARCH}" "${_file}" && \
|
||||||
sha256sum /tmp/ffmpeg-${ARCH}.tar.xz && \
|
tar -xvvpf "${_file}" --strip-components=2 --no-anchored -C /usr/local/bin/ "ffmpeg" "ffprobe" && rm -f "${_file}" && \
|
||||||
echo "${FFMPEG_EXPECTED_SHA256} /tmp/ffmpeg-${ARCH}.tar.xz" | sha256sum -c - && \
|
|
||||||
tar -xf /tmp/ffmpeg-${ARCH}.tar.xz --strip-components=2 --no-anchored -C /usr/local/bin/ "ffmpeg" && \
|
|
||||||
tar -xf /tmp/ffmpeg-${ARCH}.tar.xz --strip-components=2 --no-anchored -C /usr/local/bin/ "ffprobe" && \
|
|
||||||
# Clean up
|
# Clean up
|
||||||
rm -rf /tmp/s6-overlay-${ARCH}.tar.gz && \
|
|
||||||
rm -rf /tmp/ffmpeg-${ARCH}.tar.xz && \
|
|
||||||
apt-get -y autoremove --purge curl binutils xz-utils && \
|
apt-get -y autoremove --purge curl binutils xz-utils && \
|
||||||
rm -rf /var/lib/apt/lists/* && \
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
rm -rf /var/cache/apt/* && \
|
rm -rf /var/cache/apt/* && \
|
||||||
@ -151,6 +159,7 @@ RUN set -x && \
|
|||||||
groupadd app && \
|
groupadd app && \
|
||||||
useradd -M -d /app -s /bin/false -g app app && \
|
useradd -M -d /app -s /bin/false -g app app && \
|
||||||
# Install non-distro packages
|
# Install non-distro packages
|
||||||
|
cp -at /tmp/ "${HOME}" && HOME="/tmp/${HOME#/}" && \
|
||||||
PIPENV_VERBOSITY=64 pipenv install --system --skip-lock && \
|
PIPENV_VERBOSITY=64 pipenv install --system --skip-lock && \
|
||||||
# Clean up
|
# Clean up
|
||||||
rm /app/Pipfile && \
|
rm /app/Pipfile && \
|
||||||
@ -172,12 +181,7 @@ RUN set -x && \
|
|||||||
apt-get -y autoclean && \
|
apt-get -y autoclean && \
|
||||||
rm -rf /var/lib/apt/lists/* && \
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
rm -rf /var/cache/apt/* && \
|
rm -rf /var/cache/apt/* && \
|
||||||
rm -rf /tmp/* && \
|
rm -rf /tmp/*
|
||||||
# Pipenv leaves a bunch of stuff in /root, as we're not using it recreate it
|
|
||||||
rm -rf /root && \
|
|
||||||
mkdir -p /root && \
|
|
||||||
chown root:root /root && \
|
|
||||||
chmod 0755 /root
|
|
||||||
|
|
||||||
|
|
||||||
# Copy app
|
# Copy app
|
||||||
|
Loading…
Reference in New Issue
Block a user