From d8499e61a83f43b34dc940fc0a1971fe76996be3 Mon Sep 17 00:00:00 2001 From: Kevin Pirnie Date: Sun, 25 Aug 2024 13:29:17 -0400 Subject: [PATCH 1/5] from upstream --- Dockerfile | 34 ---------------------------------- stream_handler.go | 4 ++++ 2 files changed, 4 insertions(+), 34 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index eeda4ee..0000000 --- a/Dockerfile +++ /dev/null @@ -1,34 +0,0 @@ -# Start from the official Golang image -FROM golang:alpine AS build - -# Set the Current Working Directory inside the container -WORKDIR /app - -# Copy go mod and sum files -COPY go.mod go.sum ./ - -# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed -RUN go mod download - -# Copy the source code from the current directory to the Working Directory inside the container -COPY . . - -RUN go test ./... \ - && go build -ldflags='-s -w' -o main . - -# End from the latest alpine image -# hadolint ignore=DL3007 -FROM alpine:latest - -# add bash and timezone data -# hadolint ignore=DL3018 -RUN apk --no-cache add tzdata - -# set the current workdir -WORKDIR /app - -# copy in our compiled GO app -COPY --from=build /app/main /app/ - -# the containers entrypoint -ENTRYPOINT [ "/app/main" ] diff --git a/stream_handler.go b/stream_handler.go index fe9543e..1c0c848 100644 --- a/stream_handler.go +++ b/stream_handler.go @@ -75,6 +75,10 @@ func loadBalancer(stream database.StreamInfo, previous *[]int) (*http.Response, } if allSkipped { + + // get our custom channel offline video to return + + if debug { log.Printf("[DEBUG] All streams skipped in lap %d\n", lap) } From eeec5600e160cfaf26e0348d5f33babfcc5b52fe Mon Sep 17 00:00:00 2001 From: Kevin Pirnie Date: Sun, 25 Aug 2024 13:32:32 -0400 Subject: [PATCH 2/5] add back original dockerfile --- Dockerfile | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..76ab5f7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +# Start from the official Golang image +FROM golang:alpine AS build + +# Set the Current Working Directory inside the container +WORKDIR /app + +# Copy go mod and sum files +COPY go.mod go.sum ./ + +# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed +RUN go mod download + +# Copy the source code from the current directory to the Working Directory inside the container +COPY . . + +RUN go test ./... \ + && go build -ldflags='-s -w' -o main . + +# End from the latest alpine image +# hadolint ignore=DL3007 +FROM alpine:latest + +# add bash and timezone data +# hadolint ignore=DL3018 +RUN apk --no-cache add tzdata + +# set the current workdir +WORKDIR /app + +# copy in our compiled GO app +COPY --from=build /app/main /app/ + +# the containers entrypoint +ENTRYPOINT [ "/app/main" ] \ No newline at end of file From 440f17635b0c2746b9bd180814a4b6a0311520c5 Mon Sep 17 00:00:00 2001 From: Kevin Pirnie Date: Sun, 25 Aug 2024 13:56:17 -0400 Subject: [PATCH 3/5] fix up dockerfile to allow test to run without issues --- Dockerfile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 76ab5f7..b354bd5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,14 @@ # Start from the official Golang image FROM golang:alpine AS build +# install redis +# hadolint ignore=DL3018 +RUN apk --no-cache add redis + +# replace the bind address +RUN \ + sed -i "s/bind .*/bind 127.0.0.1/g" /etc/redis.conf + # Set the Current Working Directory inside the container WORKDIR /app @@ -13,7 +21,10 @@ RUN go mod download # Copy the source code from the current directory to the Working Directory inside the container COPY . . -RUN go test ./... \ +# fire up redis server and test and build the app. +RUN \ + redis-server --daemonize yes && \ + go test ./... \ && go build -ldflags='-s -w' -o main . # End from the latest alpine image From 8296c119c9e580eb3d6aece435c493b3a5861685 Mon Sep 17 00:00:00 2001 From: Son Roy Almerol Date: Sun, 25 Aug 2024 14:08:34 -0400 Subject: [PATCH 4/5] remove redis from github workflows and consolidate RUN commands --- .github/workflows/developer.yml | 8 -------- .github/workflows/pr-build.yml | 8 -------- .github/workflows/release.yml | 8 -------- Dockerfile | 7 ++----- 4 files changed, 2 insertions(+), 29 deletions(-) diff --git a/.github/workflows/developer.yml b/.github/workflows/developer.yml index b33bce3..e16dedc 100644 --- a/.github/workflows/developer.yml +++ b/.github/workflows/developer.yml @@ -13,10 +13,6 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - uses: shogo82148/actions-setup-redis@v1 - with: - redis-version: "latest" - - name: Docker - Login uses: docker/login-action@v3 with: @@ -25,10 +21,6 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - with: - driver-opts: | - image=moby/buildkit:master - network=host - name: Docker - Metadata id: meta diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index dd10e54..e80258b 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -15,10 +15,6 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - uses: shogo82148/actions-setup-redis@v1 - with: - redis-version: "latest" - - name: Login to GitHub Container Registry if: github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name, 'push-to-ghcr') uses: docker/login-action@v3 @@ -29,10 +25,6 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - with: - driver-opts: | - image=moby/buildkit:master - network=host - name: Docker - Metadata id: meta diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ef56c45..2e4a773 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,10 +13,6 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - uses: shogo82148/actions-setup-redis@v1 - with: - redis-version: "latest" - - name: Docker - Login uses: docker/login-action@v3 with: @@ -28,10 +24,6 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - with: - driver-opts: | - image=moby/buildkit:master - network=host - name: Docker - Metadata id: meta diff --git a/Dockerfile b/Dockerfile index b354bd5..86cba46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,10 +3,7 @@ FROM golang:alpine AS build # install redis # hadolint ignore=DL3018 -RUN apk --no-cache add redis - -# replace the bind address -RUN \ +RUN apk --no-cache add redis && \ sed -i "s/bind .*/bind 127.0.0.1/g" /etc/redis.conf # Set the Current Working Directory inside the container @@ -42,4 +39,4 @@ WORKDIR /app COPY --from=build /app/main /app/ # the containers entrypoint -ENTRYPOINT [ "/app/main" ] \ No newline at end of file +ENTRYPOINT [ "/app/main" ] From 76a8325703ad28b15271a4a5a59ea05219a2febe Mon Sep 17 00:00:00 2001 From: Son Roy Almerol Date: Sun, 25 Aug 2024 14:10:37 -0400 Subject: [PATCH 5/5] remove stream_handler comment --- stream_handler.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/stream_handler.go b/stream_handler.go index 9806597..16436e1 100644 --- a/stream_handler.go +++ b/stream_handler.go @@ -75,10 +75,6 @@ func loadBalancer(stream database.StreamInfo, previous *[]int) (*http.Response, } if allSkipped { - - // get our custom channel offline video to return - - if debug { log.Printf("[DEBUG] All streams skipped in lap %d\n", lap) }