Skip to content

Commit

Permalink
Opimization
Browse files Browse the repository at this point in the history
- rebase to main Alpine image
- switch to using official apk build of streamlink
- supply custom Alpine repo list to aid in keeping packages in autobuild images fresh
- reworked some docker layers for cache benefit
  • Loading branch information
kjake committed Mar 24, 2024
1 parent 66a8849 commit 0015617
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
20 changes: 7 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
FROM python:alpine
FROM alpine:latest
LABEL maintainer="kjake"

ENV streamlinkCommit=8d73b096066e3a84af4057f5aa589f7a65e5ab34
COPY ./repositories /etc/apk/

RUN apk add --update --no-cache && \
apk add --no-cache gosu --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ && \
# needed to support VAAPI, but basically limits architectures to only amd64
# apk add --no-cache intel-media-driver libva-intel-driver libva-vdpau-driver --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community/ && \
apk add --no-cache py3-pip jq git ffmpeg ca-certificates && \
pip3 install --upgrade git+https://github.com/streamlink/streamlink.git@${streamlinkCommit} && \
echo 'export PATH="${HOME}/.local/bin:${PATH}"' && \
mkdir /home/download && \
mkdir /home/script && \
mkdir /home/plugins && \
apk del git && \
rm -rf /var/cache/apk/* /tmp/* /var/tmp/ ~/.cache/pip
# the following would be needed to support VAAPI, but essentially limits architectures to only amd64
# intel-media-driver libva-intel-driver libva-vdpau-driver
apk add --no-cache gosu streamlink jq ffmpeg ca-certificates

RUN mkdir /home/download /home/script /home/plugins && \
rm -rf /var/cache/apk/* /tmp/* /var/tmp/

COPY ./streamlink-recorder.sh /home/script/
COPY ./entrypoint.sh /home/script
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Description

This is a Docker Container to record a livestream into a MP4 file. It uses the official [Python Image](https://hub.docker.com/_/python) with the Tag *alpine*, installs [streamlink](https://github.com/streamlink/streamlink) and uses the Script [streamlink-recorder.sh](https://raw.githubusercontent.com/lauwarm/docker-streamlink-recorder/main/streamlink-recorder.sh) to periodically check if the stream is live.
This is a Docker Container to record a livestream into a MP4 file. It uses the official [Alpine Image](https://hub.docker.com/_/alpine) with the Tag *latest*, installs [streamlink](https://github.com/streamlink/streamlink), [ffmpeg](https://github.com/FFmpeg/FFmpeg), and runs a modified version of the script [streamlink-recorder.sh](https://raw.githubusercontent.com/lauwarm/docker-streamlink-recorder/main/streamlink-recorder.sh) to periodically check if the stream is live.

> [!WARNING]
> I have been testing and using this with Twitch only, which uses AAC audio streams. This implementation is assuming AAC audio and running a minor conversion on the audio stream to be more compatible with the MP4 container.
Expand Down
4 changes: 4 additions & 0 deletions repositories
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
https://dl-cdn.alpinelinux.org/alpine/latest-stable/main
https://dl-cdn.alpinelinux.org/alpine/latest-stable/community
http://dl-cdn.alpinelinux.org/alpine/edge/community
http://dl-cdn.alpinelinux.org/alpine/edge/testing

0 comments on commit 0015617

Please sign in to comment.