Skip to content

Commit

Permalink
Refactor Dockerfile to support multi-architecture builds. Added TARGE…
Browse files Browse the repository at this point in the history
…TARCH argument to dynamically select the appropriate yt-dlp binary based on the architecture, enhancing build flexibility and compatibility across different environments.
  • Loading branch information
svemat01 committed Jan 22, 2025
1 parent 2d08879 commit 8badf2c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ FROM alpine:3.19 AS builder
ARG CHANNEL=stable
ARG ORIGIN=local
ARG VERSION
ARG TARGETARCH

RUN apk --update add --no-cache \
build-base \
Expand Down Expand Up @@ -41,6 +42,14 @@ RUN echo "Done building" && ls -laR /yt-dlp/dist

FROM debian:trixie-slim

COPY --from=builder --chmod=755 /yt-dlp/dist/yt-dlp_linux /usr/bin/yt-dlp
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

Check warning on line 53 in Dockerfile

View workflow job for this annotation

GitHub Actions / build

Variables should be defined before their use

UndefinedVar: Usage of undefined variable '$BINARY' More info: https://docs.docker.com/go/dockerfile/rule/undefined-var/

ENTRYPOINT ["/usr/bin/yt-dlp"]

0 comments on commit 8badf2c

Please sign in to comment.