Fix nightly docker image (#1590)

* Fix nightly docker image

* fix path to release binary

* 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 .
```

---------

Co-authored-by: Matthias <matthias@endler.dev>
This commit is contained in:
Trask Stalnaker 2024-12-18 00:21:50 -08:00 committed by GitHub
parent c0be8c551b
commit 76dbd843f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 34 additions and 23 deletions

View file

@ -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

View file

@ -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

View file

@ -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