Skip to content

Commit

Permalink
Preparing migration to buildah-build action
Browse files Browse the repository at this point in the history
  • Loading branch information
cremuzzi committed Nov 3, 2024
1 parent 3af94d2 commit bfe36d3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,27 @@ name: Container image build
on:
push:
branches:
- develop
- master
paths:
- "Dockerfile"
- "Containerfile"
pull_request:
branches:
- master
paths:
- "Dockerfile"

- "Containerfile"
jobs:
build:
runs-on: ubuntu-22.04
name: Build image
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v2
- name: Build the container image
run: docker build . -f ./Dockerfile -t mpv:$(date +%s)
- uses: actions/checkout@v4

- uses: redhat-actions/buildah-build@v2
name: Buildah action
with:
image: ${{ github.repository }}
tags: ${{ github.sha }}
containerfiles: |
./Containerfile
7 changes: 5 additions & 2 deletions Dockerfile → Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ LABEL org.label-schema.name="mpv"
LABEL org.label-schema.schema-version="1.0"
LABEL org.label-schema.vcs-url="https://github.com/cremuzzi/docker-mpv"

ARG YTDL_VERSION=2024.08.07

RUN apk add --no-cache \
ffmpeg \
mesa-demos \
Expand All @@ -15,8 +17,9 @@ RUN apk add --no-cache \
python3 \
ttf-dejavu \
&& ln -s python3 /usr/bin/python \
&& wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl \
&& chmod 755 /usr/local/bin/youtube-dl \
&& wget https://github.com/ytdl-org/ytdl-nightly/releases/download/${YTDL_VERSION}/youtube-dl \
-O /usr/local/bin/youtube-dl \
&& chmod 0755 /usr/local/bin/youtube-dl \
&& adduser -u 1000 -D mpv \
&& mkdir -p /home/mpv/media \
&& mkdir -p /home/mpv/.config/pulse \
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ Once you are there, you can just explore the folder and play the media file that
Please notice in the example above that we are mounting a few volumes that allow your container to
connect as a client to your host's pulseaudio and Xorg server.

## youtube-dl
## yt-dl

The image comes with **youtube-dl** as well. So you can play YT content directly like this:
This image comes with **yt-dl** installed.
You can play yt-dl supported content via
running this image with command `mpv https://media/url/`.

Eg.:

```sh
docker run --rm -i -t \
Expand All @@ -36,11 +40,10 @@ docker run --rm -i -t \
-v /etc/machine-id:/etc/machine-id:ro \
-v /run/user/1000/pulse:/run/user/1000/pulse \
-v $HOME/.Xauthority:/home/mpv/.Xauthority \
cremuzzi/mpv mpv http://youtube.com/watch?v=yt-video-id
cremuzzi/mpv mpv https://media/url/
```

The difference here is that we are not mounting any media folder from the host.
In this example we are running a container with the custom command "mpv yt-video-url", then mpv will take care of everything for you.
As long as your media url is retrievable by yt-dl then mpv should take care of reproducing it.

## Further reading

Expand Down

0 comments on commit bfe36d3

Please sign in to comment.