Compare commits
36 Commits
f30686fd7c
...
v1.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
5748834af4
|
|||
|
06d2a5ef01
|
|||
|
bdcd77eff1
|
|||
|
4541559f47
|
|||
|
906ef98bd5
|
|||
|
640c952b20
|
|||
|
2c99fbf517
|
|||
| 81968a6811 | |||
|
7d83fd8518
|
|||
| 7b34919e72 | |||
|
98fec74ac0
|
|||
| 2269104805 | |||
| 4bea5e020f | |||
| 60803961b3 | |||
|
197e35314a
|
|||
|
db0c0a3893
|
|||
|
46fec9b85a
|
|||
|
204404b761
|
|||
| 6e7fc73420 | |||
|
67c85aebf9
|
|||
| b9088d932c | |||
|
8c1d044f79
|
|||
| f688ee035f | |||
|
7fd5d93b6d
|
|||
|
d7ad90a1d5
|
|||
| ac5abffd74 | |||
|
1c43c62523
|
|||
| bef0a4d593 | |||
|
bf7739228f
|
|||
| 270934613f | |||
|
5cea64626c
|
|||
| 70d72759ce | |||
|
c537874adb
|
|||
|
b496d14cf7
|
|||
|
c2de1abfd2
|
|||
|
635d5d5113
|
@@ -23,14 +23,14 @@ jobs:
|
|||||||
|
|
||||||
# Set up Docker Buildx for building the image
|
# Set up Docker Buildx for building the image
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v4
|
||||||
with:
|
with:
|
||||||
driver: remote
|
driver: remote
|
||||||
endpoint: 'tcp://buildkitd:1234'
|
endpoint: 'tcp://buildkitd:1234'
|
||||||
|
|
||||||
# Log in to the Gitea container registry
|
# Log in to the Gitea container registry
|
||||||
- name: Log in to Gitea Container Registry
|
- name: Log in to Gitea Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v4
|
||||||
with:
|
with:
|
||||||
registry: git.dubyatp.xyz
|
registry: git.dubyatp.xyz
|
||||||
username: williamp
|
username: williamp
|
||||||
@@ -38,7 +38,7 @@ jobs:
|
|||||||
|
|
||||||
# Build and push the Docker image
|
# Build and push the Docker image
|
||||||
- name: Build and Push Docker Image
|
- name: Build and Push Docker Image
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v7
|
||||||
with:
|
with:
|
||||||
context: . # Build context (current directory)
|
context: . # Build context (current directory)
|
||||||
file: ./Dockerfile # Path to Dockerfile
|
file: ./Dockerfile # Path to Dockerfile
|
||||||
@@ -75,8 +75,13 @@ jobs:
|
|||||||
git config --local user.signingkey ~/.ssh/id_ed25519
|
git config --local user.signingkey ~/.ssh/id_ed25519
|
||||||
git config --local gpg.format ssh
|
git config --local gpg.format ssh
|
||||||
git config --local commit.gpgsign true
|
git config --local commit.gpgsign true
|
||||||
git commit -a -m "yt-dlp-bot: deploy update to ${{ needs.build-and-push.outputs.sha_short }}"
|
|
||||||
|
if [ -n "$(git status --porcelain)" ]; then
|
||||||
|
git commit -a -m "yt-dlp-bot: deploy update to ${{ needs.build-and-push.outputs.sha_short }}"
|
||||||
|
else
|
||||||
|
echo "No changes to commit, skipping..."
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
- name: Push changes
|
- name: Push changes
|
||||||
uses: ad-m/github-push-action@v1.0.0
|
uses: ad-m/github-push-action@v1.0.0
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
name: Build only (for PRs)
|
name: Build only (for PRs)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
pull_request:
|
||||||
branches:
|
|
||||||
- v1-refactor # after this has been merged
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-only:
|
build-only:
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
name: Build and Push Docker Image
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- v1-refactor # Trigger on push to the main branch; adjust as needed
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-push:
|
|
||||||
runs-on: ubuntu-latest # Use a runner with Docker support
|
|
||||||
container: ghcr.io/catthehacker/ubuntu:act-latest # Image with Docker pre-installed
|
|
||||||
outputs:
|
|
||||||
sha_short: ${{ steps.vars.outputs.sha_short }}
|
|
||||||
steps:
|
|
||||||
# Checkout the repository code
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Set outputs
|
|
||||||
id: vars
|
|
||||||
run: |
|
|
||||||
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
# Set up Docker Buildx for building the image
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
|
||||||
driver: remote
|
|
||||||
endpoint: 'tcp://buildkitd:1234'
|
|
||||||
|
|
||||||
# Log in to the Gitea container registry
|
|
||||||
- name: Log in to Gitea Container Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: git.dubyatp.xyz
|
|
||||||
username: williamp
|
|
||||||
password: ${{ secrets.ACTIONS_TOKEN }} # Personal Access Token for authentication
|
|
||||||
|
|
||||||
# Build and push the Docker image
|
|
||||||
- name: Build and Push Docker Image
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: . # Build context (current directory)
|
|
||||||
file: ./Dockerfile # Path to Dockerfile
|
|
||||||
platforms: "linux/amd64,linux/arm64"
|
|
||||||
push: true # Push to registry after building
|
|
||||||
tags: |
|
|
||||||
git.dubyatp.xyz/williamp/yt-dlp-bot:refactor-test-${{steps.vars.outputs.sha_short }}
|
|
||||||
# Tags the image with 'latest' and the commit SHA
|
|
||||||
+27
-15
@@ -9,37 +9,49 @@ ARG YT_DLP_VERSION="2026.03.03"
|
|||||||
# Deno builder stage
|
# Deno builder stage
|
||||||
FROM denoland/deno:bin-2.6.6@sha256:9f18d20207f2699595ea26d14e0b7e123cd0cd01100a577bc11f8ca5906c2d81 AS deno-builder
|
FROM denoland/deno:bin-2.6.6@sha256:9f18d20207f2699595ea26d14e0b7e123cd0cd01100a577bc11f8ca5906c2d81 AS deno-builder
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# FFmpeg builder stage
|
|
||||||
FROM debian:13-slim@sha256:1d3c811171a08a5adaa4a163fbafd96b61b87aa871bbc7aa15431ac275d3d430 AS ffmpeg-builder
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y --no-install-recommends ffmpeg
|
|
||||||
RUN mkdir -p /rootfs/bin && \
|
|
||||||
cp /usr/bin/ffmpeg /usr/bin/ffprobe /rootfs/bin/ && \
|
|
||||||
ldd /usr/bin/ffmpeg | awk '{print $3}' | grep "^/" | xargs -I '{}' cp --parents '{}' /rootfs && \
|
|
||||||
ldd /usr/bin/ffmpeg | awk 'NF==2 {print $1}' | grep "^/" | xargs -I '{}' cp --parents '{}' /rootfs
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# YT-DLP builder stage
|
# YT-DLP builder stage
|
||||||
FROM alpine:3.23@sha256:25109184c71bdad752c8312a8623239686a9a2071e8825f20acb8f2198c3f659 AS yt-dlp-builder
|
FROM alpine:3.23@sha256:25109184c71bdad752c8312a8623239686a9a2071e8825f20acb8f2198c3f659 AS yt-dlp-builder
|
||||||
ARG YT_DLP_VERSION
|
ARG YT_DLP_VERSION
|
||||||
|
ARG TARGETARCH
|
||||||
|
|
||||||
RUN mkdir -p /rootfs/target /rootfs/tmp /rootfs/bin
|
RUN mkdir -p /rootfs/target /rootfs/tmp /rootfs/bin
|
||||||
|
|
||||||
ADD "https://github.com/yt-dlp/yt-dlp/releases/download/${YT_DLP_VERSION}/yt-dlp_linux" /yt-dlp_linux
|
|
||||||
ADD "https://github.com/yt-dlp/yt-dlp/releases/download/${YT_DLP_VERSION}/SHA2-256SUMS" /SHA2-256SUMS
|
ADD "https://github.com/yt-dlp/yt-dlp/releases/download/${YT_DLP_VERSION}/SHA2-256SUMS" /SHA2-256SUMS
|
||||||
ADD "https://github.com/yt-dlp/yt-dlp/releases/download/${YT_DLP_VERSION}/SHA2-256SUMS.sig" /SHA2-256SUMS.sig
|
ADD "https://github.com/yt-dlp/yt-dlp/releases/download/${YT_DLP_VERSION}/SHA2-256SUMS.sig" /SHA2-256SUMS.sig
|
||||||
ADD "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xAC0CBBE6848D6A873464AF4E57CF65933B5A7581" "/yt-dlp_pubkey.asc"
|
ADD "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xAC0CBBE6848D6A873464AF4E57CF65933B5A7581" "/yt-dlp_pubkey.asc"
|
||||||
|
|
||||||
RUN apk add --no-cache gnupg && \
|
RUN apk add --no-cache gnupg && \
|
||||||
gpg --import /yt-dlp_pubkey.asc && \
|
gpg --import /yt-dlp_pubkey.asc && \
|
||||||
gpg --verify /SHA2-256SUMS.sig /SHA2-256SUMS && \
|
gpg --verify /SHA2-256SUMS.sig /SHA2-256SUMS
|
||||||
grep " yt-dlp_linux$" /SHA2-256SUMS | sha256sum -c -
|
|
||||||
|
|
||||||
RUN mv /yt-dlp_linux /rootfs/bin/yt-dlp && \
|
RUN case "$TARGETARCH" in \
|
||||||
|
amd64) YT_DLP_FILE="yt-dlp_linux" ;; \
|
||||||
|
arm64) YT_DLP_FILE="yt-dlp_linux_aarch64" ;; \
|
||||||
|
*) echo "Unsupported architecture: $TARGETARCH" && exit 1 ;; \
|
||||||
|
esac && \
|
||||||
|
wget -qO "/${YT_DLP_FILE}" "https://github.com/yt-dlp/yt-dlp/releases/download/${YT_DLP_VERSION}/${YT_DLP_FILE}" && \
|
||||||
|
grep " ${YT_DLP_FILE}$" /SHA2-256SUMS | sha256sum -c - && \
|
||||||
|
mv "/${YT_DLP_FILE}" /rootfs/bin/yt-dlp && \
|
||||||
chmod 755 /rootfs/bin/yt-dlp && \
|
chmod 755 /rootfs/bin/yt-dlp && \
|
||||||
chmod 1777 /rootfs/tmp
|
chmod 1777 /rootfs/tmp
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# FFmpeg builder stage
|
||||||
|
FROM debian:13-slim@sha256:1d3c811171a08a5adaa4a163fbafd96b61b87aa871bbc7aa15431ac275d3d430 AS ffmpeg-builder
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends ffmpeg
|
||||||
|
COPY --from=yt-dlp-builder /rootfs/bin/yt-dlp /yt-dlp
|
||||||
|
RUN mkdir -p /rootfs/bin && \
|
||||||
|
cp /usr/bin/ffmpeg /usr/bin/ffprobe /rootfs/bin/ && \
|
||||||
|
{ ldd /usr/bin/ffmpeg; ldd /yt-dlp; } 2>/dev/null | \
|
||||||
|
grep -o '/[^ ]*' | sort -u | \
|
||||||
|
xargs -I '{}' cp --parents '{}' /rootfs && \
|
||||||
|
LIBDIR=$(dirname "$(find /rootfs -name 'libc.so.6' | head -1)") && \
|
||||||
|
for stub in libutil.so.1 libdl.so.2 libpthread.so.0 librt.so.1; do \
|
||||||
|
[ -f "${LIBDIR}/${stub}" ] || ln -sf libc.so.6 "${LIBDIR}/${stub}"; \
|
||||||
|
done
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# App builder stage
|
# App builder stage
|
||||||
FROM golang:1.25.8-trixie@sha256:bc16125656839ffe56154c675f7a9662bec2ef7d4060177239914e7c6d2fd8a8 AS app-builder
|
FROM golang:1.25.8-trixie@sha256:bc16125656839ffe56154c675f7a9662bec2ef7d4060177239914e7c6d2fd8a8 AS app-builder
|
||||||
@@ -76,4 +88,4 @@ LABEL org.opencontainers.image.title="yt-dlp bot" \
|
|||||||
org.opencontainers.image.authors="William Peebles <me@williamtpeebles.com>" \
|
org.opencontainers.image.authors="William Peebles <me@williamtpeebles.com>" \
|
||||||
org.opencontainers.image.vendor="William Peebles" \
|
org.opencontainers.image.vendor="William Peebles" \
|
||||||
org.opencontainers.image.licenses="MIT" \
|
org.opencontainers.image.licenses="MIT" \
|
||||||
org.opencontainers.image.source="https://git.dubyatp.xyz/williamp/yt-dlp-bot"
|
org.opencontainers.image.source="https://git.dubyatp.xyz/williamp/yt-dlp-bot"
|
||||||
@@ -154,7 +154,6 @@ func DownloadVideo(out_dir, temp_dir, url string, opts DownloadOptions, progress
|
|||||||
SetExecutable(ytdlpBinary).
|
SetExecutable(ytdlpBinary).
|
||||||
Paths(homePath).
|
Paths(homePath).
|
||||||
Paths(tempPath).
|
Paths(tempPath).
|
||||||
RecodeVideo("mp4").
|
|
||||||
ProgressFunc(100*time.Millisecond, func(prog ytdlp.ProgressUpdate) {
|
ProgressFunc(100*time.Millisecond, func(prog ytdlp.ProgressUpdate) {
|
||||||
if prog.Status == ytdlp.ProgressStatusFinished ||
|
if prog.Status == ytdlp.ProgressStatusFinished ||
|
||||||
prog.Status == ytdlp.ProgressStatusStarting ||
|
prog.Status == ytdlp.ProgressStatusStarting ||
|
||||||
|
|||||||
@@ -46,8 +46,11 @@
|
|||||||
.venv/bin/pip install -r ./app/requirements.txt
|
.venv/bin/pip install -r ./app/requirements.txt
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
fi
|
fi
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
|
||||||
export YTDLP_BIN=${pkgs.lib.getExe pkgs.yt-dlp}
|
export YTDLP_BIN=${pkgs.lib.getExe pkgs.yt-dlp}
|
||||||
|
>>>>>>> v1-refactor
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user