Skip to content

Commit

Permalink
/bin/tgzebot
Browse files Browse the repository at this point in the history
  • Loading branch information
shoce committed Nov 4, 2024
1 parent 179712f commit 8eeaf73
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 14 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -1,41 +1,48 @@
# https://github.com/docker/build-push-action
# https://docs.github.com/en/actions/learn-github-actions/contexts

name: docker

permissions:
contents: read
packages: write
id-token: write

on:
push:
branches:
- main

env:
REGISTRY: ghcr.io

jobs:
build-push:
runs-on: ubuntu-latest
steps:

- name: version
run: |
VERSION=$( date '+%y.%m%d.%H%M' )
echo "VERSION:$VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2

- uses: docker/setup-buildx-action@v3

- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata

- uses: docker/metadata-action@v5
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
- name: Build and push Docker image
uses: docker/build-push-action@v4

- uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/helm.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
# https://github.com/bsord/helm-push
# https://docs.github.com/en/actions/learn-github-actions/contexts

name: helm

permissions:
packages: write
contents: read

on:
push:
branches:
- main
paths:
- 'helm/**'

jobs:
build-push:
runs-on: ubuntu-latest
steps:

- name: version
run: |
VERSION=$( date '+%y.%m%d.%H%M' )
echo "VERSION:$VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- uses: actions/checkout@v4

- name: chart version
run: |
sed -i -e "s/__VERSION__/$VERSION/g" helm/Chart.yaml
cat helm/Chart.yaml
- name: push
uses: bsord/helm-push@v4
with:
Expand Down
16 changes: 11 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@


# https://hub.docker.com/_/golang/tags
FROM golang:1.23.2 AS build
ARG TARGETARCH
WORKDIR /root/

RUN apt update
RUN apt -y -q install xz-utils
RUN curl -s -S -L -O https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-$TARGETARCH-static.tar.xz
RUN ls -l -a
RUN tar -x -J -f ffmpeg-release-$TARGETARCH-static.tar.xz
RUN ls -l -a
RUN mkdir -p /root/tgzebot/

COPY tgzebot.go go.mod go.sum /root/tgzebot/
RUN mv /root/ffmpeg-*-static/ffmpeg /root/tgzebot/ffmpeg
RUN /root/tgzebot/ffmpeg -version
Expand All @@ -21,15 +24,18 @@ RUN go build -o tgzebot tgzebot.go
RUN ls -l -a



# https://hub.docker.com/_/alpine/tags
FROM alpine:3.20.3
RUN apk add --no-cache tzdata
RUN apk add --no-cache gcompat && ln -s -f -v ld-linux-x86-64.so.2 /lib/libresolv.so.2
RUN mkdir -p /opt/tgzebot/
COPY --from=build /root/tgzebot/ffmpeg /opt/tgzebot/ffmpeg
COPY --from=build /root/tgzebot/tgzebot /opt/tgzebot/tgzebot
RUN ls -l -a /opt/tgzebot/
WORKDIR /opt/tgzebot/
ENTRYPOINT ["./tgzebot"]

COPY --from=build /root/tgzebot/ffmpeg /bin/ffmpeg
COPY --from=build /root/tgzebot/tgzebot /bin/tgzebot
RUN ls -l -a /bin/ffmpeg /bin/tgzebot

WORKDIR /root/
ENTRYPOINT ["/bin/tgzebot"]


1 change: 0 additions & 1 deletion tgzebot.go
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,6 @@ func getList(ytlistid string) (ytitems []YtVideo, err error) {
}

log("playlist title: %s", playlists.Items[0].Snippet.Title)
log("playlist item count: %d", playlists.Items[0].ContentDetails.ItemCount)

listtitle := playlists.Items[0].Snippet.Title

Expand Down

0 comments on commit 8eeaf73

Please sign in to comment.