Skip to content

Commit

Permalink
Update builder script and Dockerfile to use Python 3 and Debian base …
Browse files Browse the repository at this point in the history
…image. The builder script now explicitly uses `python3` for all commands, ensuring compatibility with the updated environment. The Dockerfile has been modified to switch from Alpine to a Debian base, updating package installation commands accordingly and enhancing the build process with improved dependency management.
  • Loading branch information
svemat01 committed Jan 22, 2025
1 parent 8badf2c commit ddbde20
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
33 changes: 15 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
FROM alpine:3.19 AS builder
FROM debian:trixie-slim AS builder

# Build arguments with defaults
ARG CHANNEL=stable
ARG ORIGIN=local
ARG VERSION
ARG TARGETARCH

RUN apk --update add --no-cache \
build-base \
RUN apt-get update && apt-get install -y \
build-essential \
python3 \
python3-pip \
python3-venv \
pipx \
;
scons \
patchelf \
binutils \
&& rm -rf /var/lib/apt/lists/*

ENV PATH="/root/.local/bin:${PATH}"

RUN pipx install pyinstaller
# Requires above step to prepare the shared venv
RUN ~/.local/share/pipx/shared/bin/python -m pip install -U wheel
RUN apk --update add --no-cache \
scons \
patchelf \
binutils \
;
RUN pipx install staticx

# Create build directory
Expand All @@ -36,20 +38,15 @@ ENV CHANNEL=${CHANNEL} \

WORKDIR /yt-dlp

RUN /builder.sh
RUN bash /builder.sh

RUN echo "Done building" && ls -laR /yt-dlp/dist

FROM debian:trixie-slim

ARG TARGETARCH
RUN case "${TARGETARCH}" in \
amd64) export BINARY="yt-dlp_linux" ;; \
*) export BINARY="yt-dlp_linux_${TARGETARCH}" ;; \
esac && \
mkdir -p /usr/bin/ && \
echo "Using binary: $BINARY"

COPY --from=builder --chmod=755 /yt-dlp/dist/${BINARY} /usr/bin/yt-dlp
COPY --from=builder --chmod=755 /yt-dlp/dist/yt-dlp_linux* /yt-dlp

RUN ln -s $(find /yt-dlp -name "yt-dlp_linux*" | head -n 1) /usr/bin/yt-dlp

ENTRYPOINT ["/usr/bin/yt-dlp"]
8 changes: 4 additions & 4 deletions builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ set -e
echo "Building with version: ${VERSION}"

source ~/.local/share/pipx/venvs/pyinstaller/bin/activate
python -m devscripts.install_deps --include secretstorage --include curl-cffi
python -m devscripts.make_lazy_extractors
python devscripts/update-version.py -c "${CHANNEL}" -r "${ORIGIN}" "${VERSION}"
python -m bundle.pyinstaller --onedir
python3 -m devscripts.install_deps --include secretstorage --include curl-cffi
python3 -m devscripts.make_lazy_extractors
python3 devscripts/update-version.py -c "${CHANNEL}" -r "${ORIGIN}" "${VERSION}"
python3 -m bundle.pyinstaller --onedir
deactivate

0 comments on commit ddbde20

Please sign in to comment.