From a8cfb5b7baa10ca8d635dec73599dda9731d4c89 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Tue, 17 Dec 2024 12:44:25 -0800 Subject: [PATCH 1/3] Fix nightly docker image --- .github/workflows/docker.yml | 4 ++++ Dockerfile-CI.Dockerfile | 6 ++++-- Dockerfile-CI.alpine.Dockerfile | 6 ++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 7370478517..ae2c1fb030 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -99,6 +99,8 @@ jobs: startsWith(github.ref, 'lychee-v') }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + build-args: | + "LYCHEE_VERSION=${{ github.ref == 'refs/heads/master' && 'nightly' || 'latest' }}" - name: Push Image (alpine) uses: docker/build-push-action@v6 @@ -111,6 +113,8 @@ jobs: startsWith(github.ref, 'lychee-v') }} tags: ${{ steps.meta-alpine.outputs.tags }} labels: ${{ steps.meta-alpine.outputs.labels }} + build-args: | + "LYCHEE_VERSION=${{ github.ref == 'refs/heads/master' && 'nightly' || 'latest' }}" - name: Update DockerHub description uses: peter-evans/dockerhub-description@v4 diff --git a/Dockerfile-CI.Dockerfile b/Dockerfile-CI.Dockerfile index 5d857672f5..fdf7bfe682 100644 --- a/Dockerfile-CI.Dockerfile +++ b/Dockerfile-CI.Dockerfile @@ -1,6 +1,8 @@ FROM debian:bookworm-slim AS builder WORKDIR /builder +ARG LYCHEE_VERSION="latest" + RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y \ --no-install-recommends \ @@ -9,10 +11,10 @@ RUN apt-get update \ wget \ && case $(dpkg --print-architecture) in \ "amd64") \ - wget -q -O - https://github.com/lycheeverse/lychee/releases/latest/download/lychee-x86_64-unknown-linux-gnu.tar.gz | tar -xz lychee \ + wget -q -O - https://github.com/lycheeverse/lychee/releases/$LYCHEE_VERSION/download/lychee-x86_64-unknown-linux-gnu.tar.gz | tar -xz lychee \ ;; \ "arm64") \ - wget -q -O - https://github.com/lycheeverse/lychee/releases/latest/download/lychee-aarch64-unknown-linux-gnu.tar.gz | tar -xz lychee \ + wget -q -O - https://github.com/lycheeverse/lychee/releases/$LYCHEE_VERSION/download/lychee-aarch64-unknown-linux-gnu.tar.gz | tar -xz lychee \ ;; \ esac \ && chmod +x lychee diff --git a/Dockerfile-CI.alpine.Dockerfile b/Dockerfile-CI.alpine.Dockerfile index c82db4ba90..019e146adc 100644 --- a/Dockerfile-CI.alpine.Dockerfile +++ b/Dockerfile-CI.alpine.Dockerfile @@ -1,14 +1,16 @@ FROM alpine:latest AS builder WORKDIR /builder +ARG LYCHEE_VERSION="latest" + RUN apk update \ && apk add --no-cache ca-certificates jq wget \ && case $(arch) in \ "x86_64") \ - wget -4 -q -O - https://github.com/lycheeverse/lychee/releases/latest/download/lychee-x86_64-unknown-linux-musl.tar.gz | tar -xz lychee \ + wget -4 -q -O - https://github.com/lycheeverse/lychee/releases/$LYCHEE_VERSION/download/lychee-x86_64-unknown-linux-musl.tar.gz | tar -xz lychee \ ;; \ "aarch64") \ - wget -4 -q -O - https://github.com/lycheeverse/lychee/releases/latest/download/lychee-arm-unknown-linux-musleabihf.tar.gz | tar -xz lychee \ + wget -4 -q -O - https://github.com/lycheeverse/lychee/releases/$LYCHEE_VERSION/download/lychee-arm-unknown-linux-musleabihf.tar.gz | tar -xz lychee \ ;; \ esac \ && chmod +x lychee From b45f78cc19e428751f5475f4de6e254041fb1236 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 18 Dec 2024 01:05:46 +0100 Subject: [PATCH 2/3] fix path to release binary --- Dockerfile-CI.Dockerfile | 4 ++-- Dockerfile-CI.alpine.Dockerfile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile-CI.Dockerfile b/Dockerfile-CI.Dockerfile index fdf7bfe682..b8d76d9f22 100644 --- a/Dockerfile-CI.Dockerfile +++ b/Dockerfile-CI.Dockerfile @@ -11,10 +11,10 @@ RUN apt-get update \ wget \ && case $(dpkg --print-architecture) in \ "amd64") \ - wget -q -O - https://github.com/lycheeverse/lychee/releases/$LYCHEE_VERSION/download/lychee-x86_64-unknown-linux-gnu.tar.gz | tar -xz lychee \ + wget -q -O - https://github.com/lycheeverse/lychee/releases/download/$LYCHEE_VERSION/lychee-x86_64-unknown-linux-gnu.tar.gz | tar -xz lychee \ ;; \ "arm64") \ - wget -q -O - https://github.com/lycheeverse/lychee/releases/$LYCHEE_VERSION/download/lychee-aarch64-unknown-linux-gnu.tar.gz | tar -xz lychee \ + wget -q -O - https://github.com/lycheeverse/lychee/releases/download/$LYCHEE_VERSION/lychee-aarch64-unknown-linux-gnu.tar.gz | tar -xz lychee \ ;; \ esac \ && chmod +x lychee diff --git a/Dockerfile-CI.alpine.Dockerfile b/Dockerfile-CI.alpine.Dockerfile index 019e146adc..7f43818b8f 100644 --- a/Dockerfile-CI.alpine.Dockerfile +++ b/Dockerfile-CI.alpine.Dockerfile @@ -7,10 +7,10 @@ RUN apk update \ && apk add --no-cache ca-certificates jq wget \ && case $(arch) in \ "x86_64") \ - wget -4 -q -O - https://github.com/lycheeverse/lychee/releases/$LYCHEE_VERSION/download/lychee-x86_64-unknown-linux-musl.tar.gz | tar -xz lychee \ + wget -4 -q -O - https://github.com/lycheeverse/lychee/releases/download/$LYCHEE_VERSION/lychee-x86_64-unknown-linux-musl.tar.gz | tar -xz lychee \ ;; \ "aarch64") \ - wget -4 -q -O - https://github.com/lycheeverse/lychee/releases/$LYCHEE_VERSION/download/lychee-arm-unknown-linux-musleabihf.tar.gz | tar -xz lychee \ + wget -4 -q -O - https://github.com/lycheeverse/lychee/releases/download/$LYCHEE_VERSION/lychee-arm-unknown-linux-musleabihf.tar.gz | tar -xz lychee \ ;; \ esac \ && chmod +x lychee From 01c38aa0bd7701d2d7d013b8e85596cb8394a937 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 18 Dec 2024 01:16:01 +0100 Subject: [PATCH 3/3] Update Dockerfile to support both latest and nightly Also supports dedicated release names like `lychee-v0.17.0` now. It can be built locally with ``` docker build --build-arg LYCHEE_VERSION=latest -f Dockerfile-CI.Dockerfile . ``` --- Dockerfile-CI.Dockerfile | 28 +++++++++++++++------------- Dockerfile-CI.alpine.Dockerfile | 21 +++++++++++---------- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/Dockerfile-CI.Dockerfile b/Dockerfile-CI.Dockerfile index b8d76d9f22..be05490cfe 100644 --- a/Dockerfile-CI.Dockerfile +++ b/Dockerfile-CI.Dockerfile @@ -4,19 +4,21 @@ WORKDIR /builder ARG LYCHEE_VERSION="latest" RUN apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y \ - --no-install-recommends \ - ca-certificates \ - jq \ - wget \ - && case $(dpkg --print-architecture) in \ - "amd64") \ - wget -q -O - https://github.com/lycheeverse/lychee/releases/download/$LYCHEE_VERSION/lychee-x86_64-unknown-linux-gnu.tar.gz | tar -xz lychee \ - ;; \ - "arm64") \ - wget -q -O - https://github.com/lycheeverse/lychee/releases/download/$LYCHEE_VERSION/lychee-aarch64-unknown-linux-gnu.tar.gz | tar -xz lychee \ - ;; \ - esac \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + ca-certificates \ + jq \ + wget \ + && rm -rf /var/lib/apt/lists/* \ + && ARCH=$(case $(dpkg --print-architecture) in \ + "amd64") echo "x86_64";; \ + "arm64") echo "aarch64";; \ + *) echo "Unsupported architecture" && exit 1;; \ + esac) \ + && BASE_URL=$(case $LYCHEE_VERSION in \ + "latest") echo "https://github.com/lycheeverse/lychee/releases/latest/download";; \ + *) echo "https://github.com/lycheeverse/lychee/releases/download/$LYCHEE_VERSION";; \ + esac) \ + && wget -q -O - "$BASE_URL/lychee-$ARCH-unknown-linux-gnu.tar.gz" | tar -xz lychee \ && chmod +x lychee FROM debian:bookworm-slim diff --git a/Dockerfile-CI.alpine.Dockerfile b/Dockerfile-CI.alpine.Dockerfile index 7f43818b8f..9c12df35d6 100644 --- a/Dockerfile-CI.alpine.Dockerfile +++ b/Dockerfile-CI.alpine.Dockerfile @@ -3,16 +3,17 @@ WORKDIR /builder ARG LYCHEE_VERSION="latest" -RUN apk update \ - && apk add --no-cache ca-certificates jq wget \ - && case $(arch) in \ - "x86_64") \ - wget -4 -q -O - https://github.com/lycheeverse/lychee/releases/download/$LYCHEE_VERSION/lychee-x86_64-unknown-linux-musl.tar.gz | tar -xz lychee \ - ;; \ - "aarch64") \ - wget -4 -q -O - https://github.com/lycheeverse/lychee/releases/download/$LYCHEE_VERSION/lychee-arm-unknown-linux-musleabihf.tar.gz | tar -xz lychee \ - ;; \ - esac \ +RUN apk add --no-cache ca-certificates jq wget \ + && ARCH=$(case $(arch) in \ + "x86_64") echo "x86_64-unknown-linux-musl";; \ + "aarch64") echo "arm-unknown-linux-musleabihf";; \ + *) echo "Unsupported architecture" && exit 1;; \ + esac) \ + && BASE_URL=$(case $LYCHEE_VERSION in \ + "latest") echo "https://github.com/lycheeverse/lychee/releases/latest/download";; \ + *) echo "https://github.com/lycheeverse/lychee/releases/download/$LYCHEE_VERSION";; \ + esac) \ + && wget -4 -q -O - "$BASE_URL/lychee-$ARCH.tar.gz" | tar -xz lychee \ && chmod +x lychee FROM alpine:latest