From b94187ab70f0cea13df72b993aad7f8ae34b9a1e Mon Sep 17 00:00:00 2001 From: Isaac Date: Wed, 14 Aug 2024 17:58:45 -0500 Subject: [PATCH] fix: arm64 images (#482) * no need to check for nil - len does that --- .github/workflows/docker-publish.yml | 1 - Dockerfile | 2 +- Dockerfile.aarch64 | 84 ---------------------------- internal/live/live.go | 2 +- internal/live/vod.go | 2 +- 5 files changed, 3 insertions(+), 88 deletions(-) delete mode 100644 Dockerfile.aarch64 diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 38419ca7..2d4b3c1b 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -60,4 +60,3 @@ jobs: push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} context: . - dockerfile: ./Dockerfile diff --git a/Dockerfile b/Dockerfile index 2637cf94..d78eec77 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,7 @@ RUN if [ "$BUILDPLATFORM" = "arm64" ]; then \ RUN git clone --depth 1 https://github.com/xenova/chat-downloader.git # Production stage -FROM --platform=$BUILDPLATFORM debian:bookworm-slim +FROM debian:bookworm-slim WORKDIR /opt/app # Install dependencies diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 deleted file mode 100644 index 182e5eab..00000000 --- a/Dockerfile.aarch64 +++ /dev/null @@ -1,84 +0,0 @@ -FROM arm64v8/golang:1.22 AS build-stage-01 - -RUN mkdir /app -ADD . /app -ADD .git /app/.git -WORKDIR /app - -RUN make build_server -RUN make build_worker - -FROM arm64v8/debian:bullseye AS build-stage-02 - -RUN apt-get update -RUN apt-get install unzip wget git -y - -WORKDIR /tmp -RUN wget https://github.com/rsms/inter/releases/download/v3.19/Inter-3.19.zip && unzip Inter-3.19.zip -RUN wget https://github.com/lay295/TwitchDownloader/releases/download/1.54.7/TwitchDownloaderCLI-1.54.7-LinuxArm.zip && unzip TwitchDownloaderCLI-1.54.7-LinuxArm.zip - -RUN git clone https://github.com/xenova/chat-downloader.git - -FROM arm64v8/debian:bullseye AS production - -## Add armhf support. -RUN dpkg --add-architecture armhf - -RUN apt-get update -RUN apt-get install python3 python3-pip fontconfig icu-devtools python3-dev gcc libc-dev curl g++ ffmpeg bash tzdata -y -RUN pip3 install --no-cache --upgrade pip -RUN pip3 install --break-system-packages --no-cache --upgrade streamlink - -## Installing su-exec in debain/ubuntu container. -RUN set -ex; \ - \ - curl -o /usr/local/bin/su-exec.c https://raw.githubusercontent.com/ncopa/su-exec/master/su-exec.c; \ - \ - gcc -Wall \ - /usr/local/bin/su-exec.c -o/usr/local/bin/su-exec; \ - chown root:root /usr/local/bin/su-exec; \ - chmod 0755 /usr/local/bin/su-exec; \ - rm /usr/local/bin/su-exec.c; \ - \ -## Remove the su-exec dependency. It is no longer needed after building. - apt-get purge -y --auto-remove curl libc-dev - -# setup user -RUN groupmod -g 1000 users && \ - useradd -u 911 -U -d /data abc && \ - usermod -G users abc - -## Add debian armhf/32bit libs for TwitchDownloaderCLI to work. -RUN apt-get install libc6:armhf zlib1g:armhf gcc:armhf libicu-dev:armhf libfontconfig1:armhf -y - -# Install chat-downloader -COPY --from=build-stage-02 /tmp/chat-downloader /tmp/chat-downloader -RUN cd /tmp/chat-downloader && python3 setup.py install && cd .. && rm -rf chat-downloader - -# Inter font install -ENV INTER_PATH "/tmp/Inter Desktop/Inter-Regular.otf" -COPY --from=build-stage-02 ${INTER_PATH} /tmp/ -RUN mkdir -p /usr/share/fonts/ && chmod a+rX /usr/share/fonts/ -RUN mv /tmp/Inter-Regular.otf /usr/share/fonts/Inter.otf && fc-cache -f -v - -# Install fallback fonts for chat rendering -RUN apt-get install xfonts-terminus fonts-inconsolata fonts-dejavu fonts-dejavu-extra fonts-noto fonts-noto-cjk fonts-font-awesome fonts-noto-extra fonts-noto-core procps -y - -RUN chmod 644 /usr/share/fonts/* && chmod -R a+rX /usr/share/fonts - -# TwitchDownloaderCLI -COPY --from=build-stage-02 /tmp/TwitchDownloaderCLI /usr/local/bin/ -RUN chmod +x /usr/local/bin/TwitchDownloaderCLI - -WORKDIR /opt/app - -COPY --from=build-stage-01 /app/ganymede-api . -COPY --from=build-stage-01 /app/ganymede-worker . - -EXPOSE 4000 - -# copy entrypoint -COPY entrypoint.sh /usr/local/bin/ -RUN chmod +x /usr/local/bin/entrypoint.sh - -ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] diff --git a/internal/live/live.go b/internal/live/live.go index be73d1b5..3bf0e1fc 100644 --- a/internal/live/live.go +++ b/internal/live/live.go @@ -249,7 +249,7 @@ OUTER: // stream is live log.Debug().Str("channel", lwc.Edges.Channel.Name).Msg("stream is live; checking for restrictions before archiving") // check for any user-constraints before archiving - if lwc.Edges.TitleRegex != nil && len(lwc.Edges.TitleRegex) > 0 { + if len(lwc.Edges.TitleRegex) > 0 { // run regexes against title for _, titleRegex := range lwc.Edges.TitleRegex { regex, err := regexp.Compile(titleRegex.Regex) diff --git a/internal/live/vod.go b/internal/live/vod.go index cf66dc28..d2dbbb90 100644 --- a/internal/live/vod.go +++ b/internal/live/vod.go @@ -130,7 +130,7 @@ func (s *Service) CheckVodWatchedChannels(ctx context.Context, logger zerolog.Lo continue } // check if there are any title regexes that need to be tested - if watch.Edges.TitleRegex != nil && len(watch.Edges.TitleRegex) > 0 { + if len(watch.Edges.TitleRegex) > 0 { // run regexes against title for _, titleRegex := range watch.Edges.TitleRegex { regex, err := regexp.Compile(titleRegex.Regex)