From 4200df21d399b2dc3d51493872a0b2f836f4890d Mon Sep 17 00:00:00 2001 From: Justin Ma Date: Wed, 30 Oct 2024 19:45:15 +0800 Subject: [PATCH] Add RELEASE_QUERY_API build arg for Dockerfiles (#14209) # Description Add `RELEASE_QUERY_API` build arg for all Dockerfiles, with default value set to `https://api.github.com/repos/nushell/nushell/releases/latest`, So that we can build the nightly images with the same Dockerfile but a different `RELEASE_QUERY_API` build arg. A nightly image build with the new Dockerfile could be found here: https://github.com/orgs/nushell/packages/container/nushell/297473460?tag=nightly # User-Facing Changes The default behavior keep the same as before # After Submitting Those who want to build a docker image with the nushell nightly release installed could run: ```nu let queryApi = http get https://api.github.com/repos/nushell/nightly/releases | sort-by -r created_at | get 0.url docker buildx build --build-arg $'RELEASE_QUERY_API=($queryApi)' ... ``` --- docker/Dockerfile | 4 +++- docker/debian.Dockerfile | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index d20ec63d91..fff3d18ef0 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -14,6 +14,8 @@ ARG ARCH=${ARCH/amd64/x86_64} ARG BUILD_REF ARG BUILD_DATE +ARG RELEASE_QUERY_API="https://api.github.com/repos/nushell/nushell/releases/latest" + LABEL maintainer="The Nushell Project Developers" \ org.opencontainers.image.licenses="MIT" \ org.opencontainers.image.title="Nushell" \ @@ -29,7 +31,7 @@ RUN echo '/usr/bin/nu' >> /etc/shells \ && adduser -D -s /usr/bin/nu nushell \ && mkdir -p /home/nushell/.config/nushell/ \ && cd /tmp \ - && wget -qO - https://api.github.com/repos/nushell/nushell/releases/latest \ + && wget -qO - ${RELEASE_QUERY_API} \ | grep browser_download_url \ | cut -d '"' -f 4 \ | grep ${ARCH}-unknown-linux-musl \ diff --git a/docker/debian.Dockerfile b/docker/debian.Dockerfile index 9a510453ef..1e2566eddb 100644 --- a/docker/debian.Dockerfile +++ b/docker/debian.Dockerfile @@ -14,6 +14,8 @@ ARG ARCH=${ARCH/amd64/x86_64} ARG BUILD_REF ARG BUILD_DATE +ARG RELEASE_QUERY_API="https://api.github.com/repos/nushell/nushell/releases/latest" + LABEL maintainer="The Nushell Project Developers" \ org.opencontainers.image.licenses="MIT" \ org.opencontainers.image.title="Nushell" \ @@ -27,7 +29,7 @@ LABEL maintainer="The Nushell Project Developers" \ RUN apt update && apt install -y wget \ && cd /tmp \ - && wget -qO - https://api.github.com/repos/nushell/nushell/releases/latest \ + && wget -qO - ${RELEASE_QUERY_API} \ | grep browser_download_url \ | cut -d '"' -f 4 \ | grep ${ARCH}-unknown-linux-gnu \