ci: setup container build

This commit is contained in:
Viktor Varland 2025-03-28 15:37:50 +01:00
parent 2451719b0f
commit 75c3137262
Signed by: varl
GPG key ID: 7459F0B410115EE8
5 changed files with 66 additions and 3 deletions

View file

@ -0,0 +1,15 @@
name: build
run-name: ${{ gitea.actor }} is building subsyt
on:
push:
branches:
- 'master'
jobs:
build:
runs-on: podman
steps:
- uses: actions/checkout@v3
- run: podman login --username registry --password ${{ secrets.MEATBAG_REGISTRY_TOKEN }} registry.meatbag.se
- run: podman build -t varl/subsyt:latest .
- run: podman push varl/subsyt registry.meatbag.se/varl/subsyt

46
Containerfile Normal file
View file

@ -0,0 +1,46 @@
FROM golang:1.24-alpine as builder
WORKDIR /src
COPY go.* .
RUN go mod download
COPY . .
RUN go build -o /src/build/subsyt .
FROM archlinux:latest
RUN pacman -Syu --noconfirm \
yt-dlp \
ffmpeg \
rtmpdump \
atomicparsley \
aria2 \
python-mutagen \
python-pycryptodome \
python-pycryptodomex \
python-websockets \
python-brotli \
python-brotlicffi \
python-xattr \
python-pyxattr
COPY <<-EOT /app/config.toml
dry_run = false
out_dir = "/data/vids"
[provider]
[provider.youtube]
cmd = "yt-dlp"
url = "https://www.youtube.com"
throttle = 1
range = "1:5:1"
after_date = "20250326"
cookies = "/data/cookies.txt"
opml_file = "/data/opml.xml"
EOT
COPY --from=builder /src/build/subsyt /app/subsyt
WORKDIR /app
ENTRYPOINT [ "/app/subsyt" ]

View file

@ -16,6 +16,7 @@ throttle = 1 # throttle yt request
range = "1:5:1" # [START][:STOP][:STEP]
after_date = "20250326" # not in use
cookies = "./cookies.txt" # pass user cookies to yt
opml_file = "./opml.xml" # the opml file to use
```
`subs-opml.xml`:

View file

@ -14,6 +14,7 @@ type Provider struct {
After_date string
Cmd string
Cookies string
Opml_file string
}
type Config struct {

View file

@ -14,13 +14,13 @@ func main() {
panic(err)
}
opml, err := opml.Load("./subs-opml.xml")
provider := cfg.Provider["youtube"]
opml, err := opml.Load(provider.Opml_file)
if err != nil {
panic(err)
}
provider := cfg.Provider["youtube"]
for _, outlines := range opml.Body.Outline {
log.Printf("Archiving videos from OPML: %s", outlines.Title)