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..be05490cfe 100644 --- a/Dockerfile-CI.Dockerfile +++ b/Dockerfile-CI.Dockerfile @@ -1,20 +1,24 @@ 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 \ - ca-certificates \ - jq \ - 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 \ - ;; \ - "arm64") \ - wget -q -O - https://github.com/lycheeverse/lychee/releases/latest/download/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 c82db4ba90..9c12df35d6 100644 --- a/Dockerfile-CI.alpine.Dockerfile +++ b/Dockerfile-CI.alpine.Dockerfile @@ -1,16 +1,19 @@ FROM alpine:latest AS builder WORKDIR /builder -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 \ - ;; \ - "aarch64") \ - wget -4 -q -O - https://github.com/lycheeverse/lychee/releases/latest/download/lychee-arm-unknown-linux-musleabihf.tar.gz | tar -xz lychee \ - ;; \ - esac \ +ARG LYCHEE_VERSION="latest" + +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