From cae81400f46e35f5dd2dca71b7ef49b400ded3b1 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 29 Nov 2021 17:39:49 -0800 Subject: [PATCH] Add initial jq-based templating engine --- .architectures-lib | 38 ----- .gitattributes | 2 + .github/workflows/verify-templating.yml | 22 +++ .gitignore | 1 + 1.0/bullseye/Dockerfile | 47 ++++-- 1.0/buster/Dockerfile | 47 ++++-- 1.0/windows/windowsservercore-1809/Dockerfile | 18 ++- .../windowsservercore-ltsc2016/Dockerfile | 18 ++- .../windowsservercore-ltsc2022/Dockerfile | 18 ++- 1.6/alpine3.14/Dockerfile | 29 ++-- 1.6/alpine3.15/Dockerfile | 29 ++-- 1.6/bullseye/Dockerfile | 47 ++++-- 1.6/buster/Dockerfile | 47 ++++-- 1.6/windows/windowsservercore-1809/Dockerfile | 18 ++- .../windowsservercore-ltsc2016/Dockerfile | 18 ++- .../windowsservercore-ltsc2022/Dockerfile | 18 ++- 1.7-rc/alpine3.14/Dockerfile | 29 ++-- 1.7-rc/alpine3.15/Dockerfile | 29 ++-- 1.7-rc/bullseye/Dockerfile | 47 ++++-- 1.7-rc/buster/Dockerfile | 47 ++++-- .../windows/windowsservercore-1809/Dockerfile | 18 ++- .../windowsservercore-ltsc2016/Dockerfile | 18 ++- .../windowsservercore-ltsc2022/Dockerfile | 18 ++- Dockerfile-alpine.template | 43 ----- Dockerfile-debian.template | 62 ------- Dockerfile-linux.template | 129 +++++++++++++++ ... => Dockerfile-windows-servercore.template | 26 +-- apply-templates.sh | 65 ++++++++ generate-stackbrew-library.sh | 153 +++++++++++------- release-architectures | 8 - update.sh | 117 +------------- versions.json | 150 +++++++++++++++++ versions.sh | 108 +++++++++++++ 33 files changed, 961 insertions(+), 523 deletions(-) delete mode 100644 .architectures-lib create mode 100644 .gitattributes create mode 100644 .github/workflows/verify-templating.yml create mode 100644 .gitignore delete mode 100644 Dockerfile-alpine.template delete mode 100644 Dockerfile-debian.template create mode 100644 Dockerfile-linux.template rename Dockerfile-windowsservercore.template => Dockerfile-windows-servercore.template (66%) create mode 100755 apply-templates.sh delete mode 100644 release-architectures create mode 100644 versions.json create mode 100755 versions.sh diff --git a/.architectures-lib b/.architectures-lib deleted file mode 100644 index ddfc2fe3..00000000 --- a/.architectures-lib +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash - -_awkArch() { - local version="$1"; shift - local awkExpr="$1"; shift - local file="$version/release-architectures" - [ -f "$file" ] || file='release-architectures' - awk "$@" "/^#|^\$/ { next } $awkExpr" "$file" -} - -dpkgArches() { - local version="$1"; shift - _awkArch "$version" '{ print $2 }' -} - -hasBashbrewArch() { - local version="$1"; shift - local bashbrewArch="$1"; shift - _awkArch "$version" 'BEGIN { exitCode = 1 } $1 == bashbrewArch { exitCode = 0 } END { exit exitCode }' -v bashbrewArch="$bashbrewArch" -} - -dpkgToBashbrewArch() { - local version="$1"; shift - local dpkgArch="$1"; shift - _awkArch "$version" '$2 == dpkgArch { print $1; exit }' -v dpkgArch="$dpkgArch" -} - -dpkgToJuliaTarArch() { - local version="$1"; shift - local dpkgArch="$1"; shift - _awkArch "$version" '$2 == dpkgArch { print $3; exit }' -v dpkgArch="$dpkgArch" -} - -dpkgToJuliaDirArch() { - local version="$1"; shift - local dpkgArch="$1"; shift - _awkArch "$version" '$2 == dpkgArch { print $4; exit }' -v dpkgArch="$dpkgArch" -} diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..90ec81cf --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +/*/**/Dockerfile linguist-generated +/Dockerfile*.template linguist-language=Dockerfile diff --git a/.github/workflows/verify-templating.yml b/.github/workflows/verify-templating.yml new file mode 100644 index 00000000..7e833f1c --- /dev/null +++ b/.github/workflows/verify-templating.yml @@ -0,0 +1,22 @@ +name: Verify Templating + +on: + pull_request: + push: + +defaults: + run: + shell: 'bash -Eeuo pipefail -x {0}' + +jobs: + apply-templates: + name: Check For Uncomitted Changes + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Apply Templates + run: ./apply-templates.sh + - name: Check Git Status + run: | + status="$(git status --short)" + [ -z "$status" ] diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..d548f66d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.jq-template.awk diff --git a/1.0/bullseye/Dockerfile b/1.0/bullseye/Dockerfile index 2441a8fd..6e43090d 100644 --- a/1.0/bullseye/Dockerfile +++ b/1.0/bullseye/Dockerfile @@ -1,3 +1,9 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM debian:bullseye-slim RUN set -eux; \ @@ -33,25 +39,34 @@ RUN set -eux; \ \ # https://julialang.org/downloads/#julia-command-line-version # https://julialang-s3.julialang.org/bin/checksums/julia-1.0.5.sha256 -# this "case" statement is generated via "update.sh" - dpkgArch="$(dpkg --print-architecture)"; \ - case "${dpkgArch##*-}" in \ -# amd64 - amd64) tarArch='x86_64'; dirArch='x64'; sha256='9dedd613777ba6ebd8aee5796915ff50aa6188ea03ed143cb687fc2aefd76b03' ;; \ -# arm32v7 - armhf) tarArch='armv7l'; dirArch='armv7l'; sha256='cfb2712765db90f0e4fa27e57a88c6d994ebcf1781f8673ebb17b5df7962d0c5' ;; \ -# arm64v8 - arm64) tarArch='aarch64'; dirArch='aarch64'; sha256='41cea1336ed8861413bb945740e567360e26f241eb3e10b3bb0fccd25655ed28' ;; \ -# i386 - i386) tarArch='i686'; dirArch='x86'; sha256='67c8f31699b79df96ce95926a363cd24ffa5bb4d9a814e071b1e8c8ff33e5a8f' ;; \ - *) echo >&2 "error: current architecture ($dpkgArch) does not have a corresponding Julia binary release"; exit 1 ;; \ + arch="$(dpkg --print-architecture)"; \ + case "$arch" in \ + 'amd64') \ + url='https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.0.5-linux-x86_64.tar.gz'; \ + sha256='9dedd613777ba6ebd8aee5796915ff50aa6188ea03ed143cb687fc2aefd76b03'; \ + ;; \ + 'armhf') \ + url='https://julialang-s3.julialang.org/bin/linux/armv7l/1.0/julia-1.0.5-linux-armv7l.tar.gz'; \ + sha256='cfb2712765db90f0e4fa27e57a88c6d994ebcf1781f8673ebb17b5df7962d0c5'; \ + ;; \ + 'arm64') \ + url='https://julialang-s3.julialang.org/bin/linux/aarch64/1.0/julia-1.0.5-linux-aarch64.tar.gz'; \ + sha256='41cea1336ed8861413bb945740e567360e26f241eb3e10b3bb0fccd25655ed28'; \ + ;; \ + 'i386') \ + url='https://julialang-s3.julialang.org/bin/linux/x86/1.0/julia-1.0.5-linux-i686.tar.gz'; \ + sha256='67c8f31699b79df96ce95926a363cd24ffa5bb4d9a814e071b1e8c8ff33e5a8f'; \ + ;; \ + *) \ + echo >&2 "error: current architecture ($arch) does not have a corresponding Julia binary release"; \ + exit 1; \ + ;; \ esac; \ \ - folder="$(echo "$JULIA_VERSION" | cut -d. -f1-2)"; \ - curl -fL -o julia.tar.gz.asc "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${folder}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz.asc"; \ - curl -fL -o julia.tar.gz "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${folder}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz"; \ + curl -fL -o julia.tar.gz.asc "$url.asc"; \ + curl -fL -o julia.tar.gz "$url"; \ \ - echo "${sha256} *julia.tar.gz" | sha256sum -c -; \ + echo "$sha256 *julia.tar.gz" | sha256sum --strict --check -; \ \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$JULIA_GPG"; \ diff --git a/1.0/buster/Dockerfile b/1.0/buster/Dockerfile index e1af0260..68d6a74a 100644 --- a/1.0/buster/Dockerfile +++ b/1.0/buster/Dockerfile @@ -1,3 +1,9 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM debian:buster-slim RUN set -eux; \ @@ -33,25 +39,34 @@ RUN set -eux; \ \ # https://julialang.org/downloads/#julia-command-line-version # https://julialang-s3.julialang.org/bin/checksums/julia-1.0.5.sha256 -# this "case" statement is generated via "update.sh" - dpkgArch="$(dpkg --print-architecture)"; \ - case "${dpkgArch##*-}" in \ -# amd64 - amd64) tarArch='x86_64'; dirArch='x64'; sha256='9dedd613777ba6ebd8aee5796915ff50aa6188ea03ed143cb687fc2aefd76b03' ;; \ -# arm32v7 - armhf) tarArch='armv7l'; dirArch='armv7l'; sha256='cfb2712765db90f0e4fa27e57a88c6d994ebcf1781f8673ebb17b5df7962d0c5' ;; \ -# arm64v8 - arm64) tarArch='aarch64'; dirArch='aarch64'; sha256='41cea1336ed8861413bb945740e567360e26f241eb3e10b3bb0fccd25655ed28' ;; \ -# i386 - i386) tarArch='i686'; dirArch='x86'; sha256='67c8f31699b79df96ce95926a363cd24ffa5bb4d9a814e071b1e8c8ff33e5a8f' ;; \ - *) echo >&2 "error: current architecture ($dpkgArch) does not have a corresponding Julia binary release"; exit 1 ;; \ + arch="$(dpkg --print-architecture)"; \ + case "$arch" in \ + 'amd64') \ + url='https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.0.5-linux-x86_64.tar.gz'; \ + sha256='9dedd613777ba6ebd8aee5796915ff50aa6188ea03ed143cb687fc2aefd76b03'; \ + ;; \ + 'armhf') \ + url='https://julialang-s3.julialang.org/bin/linux/armv7l/1.0/julia-1.0.5-linux-armv7l.tar.gz'; \ + sha256='cfb2712765db90f0e4fa27e57a88c6d994ebcf1781f8673ebb17b5df7962d0c5'; \ + ;; \ + 'arm64') \ + url='https://julialang-s3.julialang.org/bin/linux/aarch64/1.0/julia-1.0.5-linux-aarch64.tar.gz'; \ + sha256='41cea1336ed8861413bb945740e567360e26f241eb3e10b3bb0fccd25655ed28'; \ + ;; \ + 'i386') \ + url='https://julialang-s3.julialang.org/bin/linux/x86/1.0/julia-1.0.5-linux-i686.tar.gz'; \ + sha256='67c8f31699b79df96ce95926a363cd24ffa5bb4d9a814e071b1e8c8ff33e5a8f'; \ + ;; \ + *) \ + echo >&2 "error: current architecture ($arch) does not have a corresponding Julia binary release"; \ + exit 1; \ + ;; \ esac; \ \ - folder="$(echo "$JULIA_VERSION" | cut -d. -f1-2)"; \ - curl -fL -o julia.tar.gz.asc "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${folder}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz.asc"; \ - curl -fL -o julia.tar.gz "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${folder}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz"; \ + curl -fL -o julia.tar.gz.asc "$url.asc"; \ + curl -fL -o julia.tar.gz "$url"; \ \ - echo "${sha256} *julia.tar.gz" | sha256sum -c -; \ + echo "$sha256 *julia.tar.gz" | sha256sum --strict --check -; \ \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$JULIA_GPG"; \ diff --git a/1.0/windows/windowsservercore-1809/Dockerfile b/1.0/windows/windowsservercore-1809/Dockerfile index 45f7fbd8..781ce5d8 100644 --- a/1.0/windows/windowsservercore-1809/Dockerfile +++ b/1.0/windows/windowsservercore-1809/Dockerfile @@ -1,15 +1,21 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM mcr.microsoft.com/windows/servercore:1809 # $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] ENV JULIA_VERSION 1.0.5 +ENV JULIA_URL https://julialang-s3.julialang.org/bin/winnt/x64/1.0/julia-1.0.5-win64.exe ENV JULIA_SHA256 83c04bdc264e7ab87f4e22be9f3dff8c5a62a49c8edea6a0c85f4645d4cbac7a -RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win64.exe' -f $env:JULIA_VERSION, ($env:JULIA_VERSION.Split('.')[0..1] -Join '.')); \ - Write-Host ('Downloading {0} ...' -f $url); \ +RUN Write-Host ('Downloading {0} ...' -f $env:JULIA_URL); \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ - Invoke-WebRequest -Uri $url -OutFile 'julia.exe'; \ + Invoke-WebRequest -Uri $env:JULIA_URL -OutFile 'julia.exe'; \ \ Write-Host ('Verifying sha256 ({0}) ...' -f $env:JULIA_SHA256); \ if ((Get-FileHash julia.exe -Algorithm sha256).Hash -ne $env:JULIA_SHA256) { \ @@ -25,6 +31,9 @@ RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win6 '/D=C:\julia' \ ); \ \ + Write-Host 'Removing ...'; \ + Remove-Item julia.exe -Force; \ + \ Write-Host 'Updating PATH ...'; \ $env:PATH = 'C:\julia\bin;' + $env:PATH; \ [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \ @@ -32,9 +41,6 @@ RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win6 Write-Host 'Verifying install ("julia --version") ...'; \ julia --version; \ \ - Write-Host 'Removing ...'; \ - Remove-Item julia.exe -Force; \ - \ Write-Host 'Complete.' CMD ["julia"] diff --git a/1.0/windows/windowsservercore-ltsc2016/Dockerfile b/1.0/windows/windowsservercore-ltsc2016/Dockerfile index fdce3743..cf2eeb67 100644 --- a/1.0/windows/windowsservercore-ltsc2016/Dockerfile +++ b/1.0/windows/windowsservercore-ltsc2016/Dockerfile @@ -1,15 +1,21 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM mcr.microsoft.com/windows/servercore:ltsc2016 # $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] ENV JULIA_VERSION 1.0.5 +ENV JULIA_URL https://julialang-s3.julialang.org/bin/winnt/x64/1.0/julia-1.0.5-win64.exe ENV JULIA_SHA256 83c04bdc264e7ab87f4e22be9f3dff8c5a62a49c8edea6a0c85f4645d4cbac7a -RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win64.exe' -f $env:JULIA_VERSION, ($env:JULIA_VERSION.Split('.')[0..1] -Join '.')); \ - Write-Host ('Downloading {0} ...' -f $url); \ +RUN Write-Host ('Downloading {0} ...' -f $env:JULIA_URL); \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ - Invoke-WebRequest -Uri $url -OutFile 'julia.exe'; \ + Invoke-WebRequest -Uri $env:JULIA_URL -OutFile 'julia.exe'; \ \ Write-Host ('Verifying sha256 ({0}) ...' -f $env:JULIA_SHA256); \ if ((Get-FileHash julia.exe -Algorithm sha256).Hash -ne $env:JULIA_SHA256) { \ @@ -25,6 +31,9 @@ RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win6 '/D=C:\julia' \ ); \ \ + Write-Host 'Removing ...'; \ + Remove-Item julia.exe -Force; \ + \ Write-Host 'Updating PATH ...'; \ $env:PATH = 'C:\julia\bin;' + $env:PATH; \ [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \ @@ -32,9 +41,6 @@ RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win6 Write-Host 'Verifying install ("julia --version") ...'; \ julia --version; \ \ - Write-Host 'Removing ...'; \ - Remove-Item julia.exe -Force; \ - \ Write-Host 'Complete.' CMD ["julia"] diff --git a/1.0/windows/windowsservercore-ltsc2022/Dockerfile b/1.0/windows/windowsservercore-ltsc2022/Dockerfile index f6418589..4badba25 100644 --- a/1.0/windows/windowsservercore-ltsc2022/Dockerfile +++ b/1.0/windows/windowsservercore-ltsc2022/Dockerfile @@ -1,15 +1,21 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM mcr.microsoft.com/windows/servercore:ltsc2022 # $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] ENV JULIA_VERSION 1.0.5 +ENV JULIA_URL https://julialang-s3.julialang.org/bin/winnt/x64/1.0/julia-1.0.5-win64.exe ENV JULIA_SHA256 83c04bdc264e7ab87f4e22be9f3dff8c5a62a49c8edea6a0c85f4645d4cbac7a -RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win64.exe' -f $env:JULIA_VERSION, ($env:JULIA_VERSION.Split('.')[0..1] -Join '.')); \ - Write-Host ('Downloading {0} ...' -f $url); \ +RUN Write-Host ('Downloading {0} ...' -f $env:JULIA_URL); \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ - Invoke-WebRequest -Uri $url -OutFile 'julia.exe'; \ + Invoke-WebRequest -Uri $env:JULIA_URL -OutFile 'julia.exe'; \ \ Write-Host ('Verifying sha256 ({0}) ...' -f $env:JULIA_SHA256); \ if ((Get-FileHash julia.exe -Algorithm sha256).Hash -ne $env:JULIA_SHA256) { \ @@ -25,6 +31,9 @@ RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win6 '/D=C:\julia' \ ); \ \ + Write-Host 'Removing ...'; \ + Remove-Item julia.exe -Force; \ + \ Write-Host 'Updating PATH ...'; \ $env:PATH = 'C:\julia\bin;' + $env:PATH; \ [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \ @@ -32,9 +41,6 @@ RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win6 Write-Host 'Verifying install ("julia --version") ...'; \ julia --version; \ \ - Write-Host 'Removing ...'; \ - Remove-Item julia.exe -Force; \ - \ Write-Host 'Complete.' CMD ["julia"] diff --git a/1.6/alpine3.14/Dockerfile b/1.6/alpine3.14/Dockerfile index 1c29ff2b..f812e781 100644 --- a/1.6/alpine3.14/Dockerfile +++ b/1.6/alpine3.14/Dockerfile @@ -1,3 +1,9 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM alpine:3.14 ENV JULIA_PATH /usr/local/julia @@ -16,19 +22,22 @@ RUN set -eux; \ \ # https://julialang.org/downloads/#julia-command-line-version # https://julialang-s3.julialang.org/bin/checksums/julia-1.6.4.sha256 -# this "case" statement is generated via "update.sh" - apkArch="$(apk --print-arch)"; \ - case "$apkArch" in \ -# amd64 - x86_64) tarArch='x86_64'; dirArch='x64'; sha256='63f121dffa982ff9b53c7c8a334830e17e2c9d2efa79316a548d29f7f8925e66' ;; \ - *) echo >&2 "error: current architecture ($apkArch) does not have a corresponding Julia binary release"; exit 1 ;; \ + arch="$(apk --print-arch)"; \ + case "$arch" in \ + 'x86_64') \ + url='https://julialang-s3.julialang.org/bin/musl/x64/1.6/julia-1.6.4-musl-x86_64.tar.gz'; \ + sha256='63f121dffa982ff9b53c7c8a334830e17e2c9d2efa79316a548d29f7f8925e66'; \ + ;; \ + *) \ + echo >&2 "error: current architecture ($arch) does not have a corresponding Julia binary release"; \ + exit 1; \ + ;; \ esac; \ \ - folder="$(echo "$JULIA_VERSION" | cut -d. -f1-2)"; \ - wget -O julia.tar.gz.asc "https://julialang-s3.julialang.org/bin/musl/${dirArch}/${folder}/julia-${JULIA_VERSION}-musl-${tarArch}.tar.gz.asc"; \ - wget -O julia.tar.gz "https://julialang-s3.julialang.org/bin/musl/${dirArch}/${folder}/julia-${JULIA_VERSION}-musl-${tarArch}.tar.gz"; \ + wget -O julia.tar.gz.asc "$url.asc"; \ + wget -O julia.tar.gz "$url"; \ \ - echo "${sha256} *julia.tar.gz" | sha256sum -c -; \ + echo "$sha256 *julia.tar.gz" | sha256sum -w -c -; \ \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$JULIA_GPG"; \ diff --git a/1.6/alpine3.15/Dockerfile b/1.6/alpine3.15/Dockerfile index 5790c79d..5c2439b5 100644 --- a/1.6/alpine3.15/Dockerfile +++ b/1.6/alpine3.15/Dockerfile @@ -1,3 +1,9 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM alpine:3.15 ENV JULIA_PATH /usr/local/julia @@ -16,19 +22,22 @@ RUN set -eux; \ \ # https://julialang.org/downloads/#julia-command-line-version # https://julialang-s3.julialang.org/bin/checksums/julia-1.6.4.sha256 -# this "case" statement is generated via "update.sh" - apkArch="$(apk --print-arch)"; \ - case "$apkArch" in \ -# amd64 - x86_64) tarArch='x86_64'; dirArch='x64'; sha256='63f121dffa982ff9b53c7c8a334830e17e2c9d2efa79316a548d29f7f8925e66' ;; \ - *) echo >&2 "error: current architecture ($apkArch) does not have a corresponding Julia binary release"; exit 1 ;; \ + arch="$(apk --print-arch)"; \ + case "$arch" in \ + 'x86_64') \ + url='https://julialang-s3.julialang.org/bin/musl/x64/1.6/julia-1.6.4-musl-x86_64.tar.gz'; \ + sha256='63f121dffa982ff9b53c7c8a334830e17e2c9d2efa79316a548d29f7f8925e66'; \ + ;; \ + *) \ + echo >&2 "error: current architecture ($arch) does not have a corresponding Julia binary release"; \ + exit 1; \ + ;; \ esac; \ \ - folder="$(echo "$JULIA_VERSION" | cut -d. -f1-2)"; \ - wget -O julia.tar.gz.asc "https://julialang-s3.julialang.org/bin/musl/${dirArch}/${folder}/julia-${JULIA_VERSION}-musl-${tarArch}.tar.gz.asc"; \ - wget -O julia.tar.gz "https://julialang-s3.julialang.org/bin/musl/${dirArch}/${folder}/julia-${JULIA_VERSION}-musl-${tarArch}.tar.gz"; \ + wget -O julia.tar.gz.asc "$url.asc"; \ + wget -O julia.tar.gz "$url"; \ \ - echo "${sha256} *julia.tar.gz" | sha256sum -c -; \ + echo "$sha256 *julia.tar.gz" | sha256sum -w -c -; \ \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$JULIA_GPG"; \ diff --git a/1.6/bullseye/Dockerfile b/1.6/bullseye/Dockerfile index 3a5d1751..1583a033 100644 --- a/1.6/bullseye/Dockerfile +++ b/1.6/bullseye/Dockerfile @@ -1,3 +1,9 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM debian:bullseye-slim RUN set -eux; \ @@ -33,25 +39,34 @@ RUN set -eux; \ \ # https://julialang.org/downloads/#julia-command-line-version # https://julialang-s3.julialang.org/bin/checksums/julia-1.6.4.sha256 -# this "case" statement is generated via "update.sh" - dpkgArch="$(dpkg --print-architecture)"; \ - case "${dpkgArch##*-}" in \ -# amd64 - amd64) tarArch='x86_64'; dirArch='x64'; sha256='52244ae47697e8073dfbc9d1251b0422f0dbd1fbe1a41da4b9f7ddf0506b2132' ;; \ -# arm32v7 - armhf) tarArch='armv7l'; dirArch='armv7l'; sha256='9ad3f6bd71eb6840d4cef1569855da20c0b4931a2bdf77703a64df672b0702a1' ;; \ -# arm64v8 - arm64) tarArch='aarch64'; dirArch='aarch64'; sha256='072daac7229c15fa41d0c1b65b8a3d6ee747323d02f5943da3846b075291b48b' ;; \ -# i386 - i386) tarArch='i686'; dirArch='x86'; sha256='9d43d642174cf22cf0fde18dc2578c84f357d2c619b9d846d3a6da4192ba48cf' ;; \ - *) echo >&2 "error: current architecture ($dpkgArch) does not have a corresponding Julia binary release"; exit 1 ;; \ + arch="$(dpkg --print-architecture)"; \ + case "$arch" in \ + 'amd64') \ + url='https://julialang-s3.julialang.org/bin/linux/x64/1.6/julia-1.6.4-linux-x86_64.tar.gz'; \ + sha256='52244ae47697e8073dfbc9d1251b0422f0dbd1fbe1a41da4b9f7ddf0506b2132'; \ + ;; \ + 'armhf') \ + url='https://julialang-s3.julialang.org/bin/linux/armv7l/1.6/julia-1.6.4-linux-armv7l.tar.gz'; \ + sha256='9ad3f6bd71eb6840d4cef1569855da20c0b4931a2bdf77703a64df672b0702a1'; \ + ;; \ + 'arm64') \ + url='https://julialang-s3.julialang.org/bin/linux/aarch64/1.6/julia-1.6.4-linux-aarch64.tar.gz'; \ + sha256='072daac7229c15fa41d0c1b65b8a3d6ee747323d02f5943da3846b075291b48b'; \ + ;; \ + 'i386') \ + url='https://julialang-s3.julialang.org/bin/linux/x86/1.6/julia-1.6.4-linux-i686.tar.gz'; \ + sha256='9d43d642174cf22cf0fde18dc2578c84f357d2c619b9d846d3a6da4192ba48cf'; \ + ;; \ + *) \ + echo >&2 "error: current architecture ($arch) does not have a corresponding Julia binary release"; \ + exit 1; \ + ;; \ esac; \ \ - folder="$(echo "$JULIA_VERSION" | cut -d. -f1-2)"; \ - curl -fL -o julia.tar.gz.asc "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${folder}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz.asc"; \ - curl -fL -o julia.tar.gz "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${folder}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz"; \ + curl -fL -o julia.tar.gz.asc "$url.asc"; \ + curl -fL -o julia.tar.gz "$url"; \ \ - echo "${sha256} *julia.tar.gz" | sha256sum -c -; \ + echo "$sha256 *julia.tar.gz" | sha256sum --strict --check -; \ \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$JULIA_GPG"; \ diff --git a/1.6/buster/Dockerfile b/1.6/buster/Dockerfile index 8efb8aa2..064ed3c4 100644 --- a/1.6/buster/Dockerfile +++ b/1.6/buster/Dockerfile @@ -1,3 +1,9 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM debian:buster-slim RUN set -eux; \ @@ -33,25 +39,34 @@ RUN set -eux; \ \ # https://julialang.org/downloads/#julia-command-line-version # https://julialang-s3.julialang.org/bin/checksums/julia-1.6.4.sha256 -# this "case" statement is generated via "update.sh" - dpkgArch="$(dpkg --print-architecture)"; \ - case "${dpkgArch##*-}" in \ -# amd64 - amd64) tarArch='x86_64'; dirArch='x64'; sha256='52244ae47697e8073dfbc9d1251b0422f0dbd1fbe1a41da4b9f7ddf0506b2132' ;; \ -# arm32v7 - armhf) tarArch='armv7l'; dirArch='armv7l'; sha256='9ad3f6bd71eb6840d4cef1569855da20c0b4931a2bdf77703a64df672b0702a1' ;; \ -# arm64v8 - arm64) tarArch='aarch64'; dirArch='aarch64'; sha256='072daac7229c15fa41d0c1b65b8a3d6ee747323d02f5943da3846b075291b48b' ;; \ -# i386 - i386) tarArch='i686'; dirArch='x86'; sha256='9d43d642174cf22cf0fde18dc2578c84f357d2c619b9d846d3a6da4192ba48cf' ;; \ - *) echo >&2 "error: current architecture ($dpkgArch) does not have a corresponding Julia binary release"; exit 1 ;; \ + arch="$(dpkg --print-architecture)"; \ + case "$arch" in \ + 'amd64') \ + url='https://julialang-s3.julialang.org/bin/linux/x64/1.6/julia-1.6.4-linux-x86_64.tar.gz'; \ + sha256='52244ae47697e8073dfbc9d1251b0422f0dbd1fbe1a41da4b9f7ddf0506b2132'; \ + ;; \ + 'armhf') \ + url='https://julialang-s3.julialang.org/bin/linux/armv7l/1.6/julia-1.6.4-linux-armv7l.tar.gz'; \ + sha256='9ad3f6bd71eb6840d4cef1569855da20c0b4931a2bdf77703a64df672b0702a1'; \ + ;; \ + 'arm64') \ + url='https://julialang-s3.julialang.org/bin/linux/aarch64/1.6/julia-1.6.4-linux-aarch64.tar.gz'; \ + sha256='072daac7229c15fa41d0c1b65b8a3d6ee747323d02f5943da3846b075291b48b'; \ + ;; \ + 'i386') \ + url='https://julialang-s3.julialang.org/bin/linux/x86/1.6/julia-1.6.4-linux-i686.tar.gz'; \ + sha256='9d43d642174cf22cf0fde18dc2578c84f357d2c619b9d846d3a6da4192ba48cf'; \ + ;; \ + *) \ + echo >&2 "error: current architecture ($arch) does not have a corresponding Julia binary release"; \ + exit 1; \ + ;; \ esac; \ \ - folder="$(echo "$JULIA_VERSION" | cut -d. -f1-2)"; \ - curl -fL -o julia.tar.gz.asc "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${folder}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz.asc"; \ - curl -fL -o julia.tar.gz "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${folder}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz"; \ + curl -fL -o julia.tar.gz.asc "$url.asc"; \ + curl -fL -o julia.tar.gz "$url"; \ \ - echo "${sha256} *julia.tar.gz" | sha256sum -c -; \ + echo "$sha256 *julia.tar.gz" | sha256sum --strict --check -; \ \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$JULIA_GPG"; \ diff --git a/1.6/windows/windowsservercore-1809/Dockerfile b/1.6/windows/windowsservercore-1809/Dockerfile index e1a5c58d..2e7f529f 100644 --- a/1.6/windows/windowsservercore-1809/Dockerfile +++ b/1.6/windows/windowsservercore-1809/Dockerfile @@ -1,15 +1,21 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM mcr.microsoft.com/windows/servercore:1809 # $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] ENV JULIA_VERSION 1.6.4 +ENV JULIA_URL https://julialang-s3.julialang.org/bin/winnt/x64/1.6/julia-1.6.4-win64.exe ENV JULIA_SHA256 c9b6ecdad4feb57e5af12c9ef1a74993a96edbf87a4dc521d57e338397cee9b2 -RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win64.exe' -f $env:JULIA_VERSION, ($env:JULIA_VERSION.Split('.')[0..1] -Join '.')); \ - Write-Host ('Downloading {0} ...' -f $url); \ +RUN Write-Host ('Downloading {0} ...' -f $env:JULIA_URL); \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ - Invoke-WebRequest -Uri $url -OutFile 'julia.exe'; \ + Invoke-WebRequest -Uri $env:JULIA_URL -OutFile 'julia.exe'; \ \ Write-Host ('Verifying sha256 ({0}) ...' -f $env:JULIA_SHA256); \ if ((Get-FileHash julia.exe -Algorithm sha256).Hash -ne $env:JULIA_SHA256) { \ @@ -25,6 +31,9 @@ RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win6 '/DIR=C:\julia' \ ); \ \ + Write-Host 'Removing ...'; \ + Remove-Item julia.exe -Force; \ + \ Write-Host 'Updating PATH ...'; \ $env:PATH = 'C:\julia\bin;' + $env:PATH; \ [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \ @@ -32,9 +41,6 @@ RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win6 Write-Host 'Verifying install ("julia --version") ...'; \ julia --version; \ \ - Write-Host 'Removing ...'; \ - Remove-Item julia.exe -Force; \ - \ Write-Host 'Complete.' CMD ["julia"] diff --git a/1.6/windows/windowsservercore-ltsc2016/Dockerfile b/1.6/windows/windowsservercore-ltsc2016/Dockerfile index 2cb1e68d..3d035a4c 100644 --- a/1.6/windows/windowsservercore-ltsc2016/Dockerfile +++ b/1.6/windows/windowsservercore-ltsc2016/Dockerfile @@ -1,15 +1,21 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM mcr.microsoft.com/windows/servercore:ltsc2016 # $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] ENV JULIA_VERSION 1.6.4 +ENV JULIA_URL https://julialang-s3.julialang.org/bin/winnt/x64/1.6/julia-1.6.4-win64.exe ENV JULIA_SHA256 c9b6ecdad4feb57e5af12c9ef1a74993a96edbf87a4dc521d57e338397cee9b2 -RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win64.exe' -f $env:JULIA_VERSION, ($env:JULIA_VERSION.Split('.')[0..1] -Join '.')); \ - Write-Host ('Downloading {0} ...' -f $url); \ +RUN Write-Host ('Downloading {0} ...' -f $env:JULIA_URL); \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ - Invoke-WebRequest -Uri $url -OutFile 'julia.exe'; \ + Invoke-WebRequest -Uri $env:JULIA_URL -OutFile 'julia.exe'; \ \ Write-Host ('Verifying sha256 ({0}) ...' -f $env:JULIA_SHA256); \ if ((Get-FileHash julia.exe -Algorithm sha256).Hash -ne $env:JULIA_SHA256) { \ @@ -25,6 +31,9 @@ RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win6 '/DIR=C:\julia' \ ); \ \ + Write-Host 'Removing ...'; \ + Remove-Item julia.exe -Force; \ + \ Write-Host 'Updating PATH ...'; \ $env:PATH = 'C:\julia\bin;' + $env:PATH; \ [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \ @@ -32,9 +41,6 @@ RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win6 Write-Host 'Verifying install ("julia --version") ...'; \ julia --version; \ \ - Write-Host 'Removing ...'; \ - Remove-Item julia.exe -Force; \ - \ Write-Host 'Complete.' CMD ["julia"] diff --git a/1.6/windows/windowsservercore-ltsc2022/Dockerfile b/1.6/windows/windowsservercore-ltsc2022/Dockerfile index 3f9c483b..3327e73f 100644 --- a/1.6/windows/windowsservercore-ltsc2022/Dockerfile +++ b/1.6/windows/windowsservercore-ltsc2022/Dockerfile @@ -1,15 +1,21 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM mcr.microsoft.com/windows/servercore:ltsc2022 # $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] ENV JULIA_VERSION 1.6.4 +ENV JULIA_URL https://julialang-s3.julialang.org/bin/winnt/x64/1.6/julia-1.6.4-win64.exe ENV JULIA_SHA256 c9b6ecdad4feb57e5af12c9ef1a74993a96edbf87a4dc521d57e338397cee9b2 -RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win64.exe' -f $env:JULIA_VERSION, ($env:JULIA_VERSION.Split('.')[0..1] -Join '.')); \ - Write-Host ('Downloading {0} ...' -f $url); \ +RUN Write-Host ('Downloading {0} ...' -f $env:JULIA_URL); \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ - Invoke-WebRequest -Uri $url -OutFile 'julia.exe'; \ + Invoke-WebRequest -Uri $env:JULIA_URL -OutFile 'julia.exe'; \ \ Write-Host ('Verifying sha256 ({0}) ...' -f $env:JULIA_SHA256); \ if ((Get-FileHash julia.exe -Algorithm sha256).Hash -ne $env:JULIA_SHA256) { \ @@ -25,6 +31,9 @@ RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win6 '/DIR=C:\julia' \ ); \ \ + Write-Host 'Removing ...'; \ + Remove-Item julia.exe -Force; \ + \ Write-Host 'Updating PATH ...'; \ $env:PATH = 'C:\julia\bin;' + $env:PATH; \ [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \ @@ -32,9 +41,6 @@ RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win6 Write-Host 'Verifying install ("julia --version") ...'; \ julia --version; \ \ - Write-Host 'Removing ...'; \ - Remove-Item julia.exe -Force; \ - \ Write-Host 'Complete.' CMD ["julia"] diff --git a/1.7-rc/alpine3.14/Dockerfile b/1.7-rc/alpine3.14/Dockerfile index d411da7a..16a42fdb 100644 --- a/1.7-rc/alpine3.14/Dockerfile +++ b/1.7-rc/alpine3.14/Dockerfile @@ -1,3 +1,9 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM alpine:3.14 ENV JULIA_PATH /usr/local/julia @@ -16,19 +22,22 @@ RUN set -eux; \ \ # https://julialang.org/downloads/#julia-command-line-version # https://julialang-s3.julialang.org/bin/checksums/julia-1.7.0-rc3.sha256 -# this "case" statement is generated via "update.sh" - apkArch="$(apk --print-arch)"; \ - case "$apkArch" in \ -# amd64 - x86_64) tarArch='x86_64'; dirArch='x64'; sha256='68dc3d7b17fbcceea383b48d82c63c36b899e05f5cd7537a730d7578f65c40ea' ;; \ - *) echo >&2 "error: current architecture ($apkArch) does not have a corresponding Julia binary release"; exit 1 ;; \ + arch="$(apk --print-arch)"; \ + case "$arch" in \ + 'x86_64') \ + url='https://julialang-s3.julialang.org/bin/musl/x64/1.7/julia-1.7.0-rc3-musl-x86_64.tar.gz'; \ + sha256='68dc3d7b17fbcceea383b48d82c63c36b899e05f5cd7537a730d7578f65c40ea'; \ + ;; \ + *) \ + echo >&2 "error: current architecture ($arch) does not have a corresponding Julia binary release"; \ + exit 1; \ + ;; \ esac; \ \ - folder="$(echo "$JULIA_VERSION" | cut -d. -f1-2)"; \ - wget -O julia.tar.gz.asc "https://julialang-s3.julialang.org/bin/musl/${dirArch}/${folder}/julia-${JULIA_VERSION}-musl-${tarArch}.tar.gz.asc"; \ - wget -O julia.tar.gz "https://julialang-s3.julialang.org/bin/musl/${dirArch}/${folder}/julia-${JULIA_VERSION}-musl-${tarArch}.tar.gz"; \ + wget -O julia.tar.gz.asc "$url.asc"; \ + wget -O julia.tar.gz "$url"; \ \ - echo "${sha256} *julia.tar.gz" | sha256sum -c -; \ + echo "$sha256 *julia.tar.gz" | sha256sum -w -c -; \ \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$JULIA_GPG"; \ diff --git a/1.7-rc/alpine3.15/Dockerfile b/1.7-rc/alpine3.15/Dockerfile index cce200f0..437bfaa6 100644 --- a/1.7-rc/alpine3.15/Dockerfile +++ b/1.7-rc/alpine3.15/Dockerfile @@ -1,3 +1,9 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM alpine:3.15 ENV JULIA_PATH /usr/local/julia @@ -16,19 +22,22 @@ RUN set -eux; \ \ # https://julialang.org/downloads/#julia-command-line-version # https://julialang-s3.julialang.org/bin/checksums/julia-1.7.0-rc3.sha256 -# this "case" statement is generated via "update.sh" - apkArch="$(apk --print-arch)"; \ - case "$apkArch" in \ -# amd64 - x86_64) tarArch='x86_64'; dirArch='x64'; sha256='68dc3d7b17fbcceea383b48d82c63c36b899e05f5cd7537a730d7578f65c40ea' ;; \ - *) echo >&2 "error: current architecture ($apkArch) does not have a corresponding Julia binary release"; exit 1 ;; \ + arch="$(apk --print-arch)"; \ + case "$arch" in \ + 'x86_64') \ + url='https://julialang-s3.julialang.org/bin/musl/x64/1.7/julia-1.7.0-rc3-musl-x86_64.tar.gz'; \ + sha256='68dc3d7b17fbcceea383b48d82c63c36b899e05f5cd7537a730d7578f65c40ea'; \ + ;; \ + *) \ + echo >&2 "error: current architecture ($arch) does not have a corresponding Julia binary release"; \ + exit 1; \ + ;; \ esac; \ \ - folder="$(echo "$JULIA_VERSION" | cut -d. -f1-2)"; \ - wget -O julia.tar.gz.asc "https://julialang-s3.julialang.org/bin/musl/${dirArch}/${folder}/julia-${JULIA_VERSION}-musl-${tarArch}.tar.gz.asc"; \ - wget -O julia.tar.gz "https://julialang-s3.julialang.org/bin/musl/${dirArch}/${folder}/julia-${JULIA_VERSION}-musl-${tarArch}.tar.gz"; \ + wget -O julia.tar.gz.asc "$url.asc"; \ + wget -O julia.tar.gz "$url"; \ \ - echo "${sha256} *julia.tar.gz" | sha256sum -c -; \ + echo "$sha256 *julia.tar.gz" | sha256sum -w -c -; \ \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$JULIA_GPG"; \ diff --git a/1.7-rc/bullseye/Dockerfile b/1.7-rc/bullseye/Dockerfile index be519aba..ad544001 100644 --- a/1.7-rc/bullseye/Dockerfile +++ b/1.7-rc/bullseye/Dockerfile @@ -1,3 +1,9 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM debian:bullseye-slim RUN set -eux; \ @@ -33,25 +39,34 @@ RUN set -eux; \ \ # https://julialang.org/downloads/#julia-command-line-version # https://julialang-s3.julialang.org/bin/checksums/julia-1.7.0-rc3.sha256 -# this "case" statement is generated via "update.sh" - dpkgArch="$(dpkg --print-architecture)"; \ - case "${dpkgArch##*-}" in \ -# amd64 - amd64) tarArch='x86_64'; dirArch='x64'; sha256='cbf33c533d6f226161f08cdc3cec16745a3dc5afdfbaece95e3f2a5e0b6b7886' ;; \ -# arm32v7 - armhf) tarArch='armv7l'; dirArch='armv7l'; sha256='fff9370f58fd8f94f12a14d38c32d25b9e493d62a6d992edfc378caf9ef8d1cc' ;; \ -# arm64v8 - arm64) tarArch='aarch64'; dirArch='aarch64'; sha256='0662f9f31c87559ec33a24b3b83df85071357708287678ca78c7fa4498d05e5c' ;; \ -# i386 - i386) tarArch='i686'; dirArch='x86'; sha256='9ee7692faee05d7dbe431c59850542d95d260368bbf6d4f0ccdd03be07fef817' ;; \ - *) echo >&2 "error: current architecture ($dpkgArch) does not have a corresponding Julia binary release"; exit 1 ;; \ + arch="$(dpkg --print-architecture)"; \ + case "$arch" in \ + 'amd64') \ + url='https://julialang-s3.julialang.org/bin/linux/x64/1.7/julia-1.7.0-rc3-linux-x86_64.tar.gz'; \ + sha256='cbf33c533d6f226161f08cdc3cec16745a3dc5afdfbaece95e3f2a5e0b6b7886'; \ + ;; \ + 'armhf') \ + url='https://julialang-s3.julialang.org/bin/linux/armv7l/1.7/julia-1.7.0-rc3-linux-armv7l.tar.gz'; \ + sha256='fff9370f58fd8f94f12a14d38c32d25b9e493d62a6d992edfc378caf9ef8d1cc'; \ + ;; \ + 'arm64') \ + url='https://julialang-s3.julialang.org/bin/linux/aarch64/1.7/julia-1.7.0-rc3-linux-aarch64.tar.gz'; \ + sha256='0662f9f31c87559ec33a24b3b83df85071357708287678ca78c7fa4498d05e5c'; \ + ;; \ + 'i386') \ + url='https://julialang-s3.julialang.org/bin/linux/x86/1.7/julia-1.7.0-rc3-linux-i686.tar.gz'; \ + sha256='9ee7692faee05d7dbe431c59850542d95d260368bbf6d4f0ccdd03be07fef817'; \ + ;; \ + *) \ + echo >&2 "error: current architecture ($arch) does not have a corresponding Julia binary release"; \ + exit 1; \ + ;; \ esac; \ \ - folder="$(echo "$JULIA_VERSION" | cut -d. -f1-2)"; \ - curl -fL -o julia.tar.gz.asc "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${folder}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz.asc"; \ - curl -fL -o julia.tar.gz "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${folder}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz"; \ + curl -fL -o julia.tar.gz.asc "$url.asc"; \ + curl -fL -o julia.tar.gz "$url"; \ \ - echo "${sha256} *julia.tar.gz" | sha256sum -c -; \ + echo "$sha256 *julia.tar.gz" | sha256sum --strict --check -; \ \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$JULIA_GPG"; \ diff --git a/1.7-rc/buster/Dockerfile b/1.7-rc/buster/Dockerfile index a8e58deb..e0270acd 100644 --- a/1.7-rc/buster/Dockerfile +++ b/1.7-rc/buster/Dockerfile @@ -1,3 +1,9 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM debian:buster-slim RUN set -eux; \ @@ -33,25 +39,34 @@ RUN set -eux; \ \ # https://julialang.org/downloads/#julia-command-line-version # https://julialang-s3.julialang.org/bin/checksums/julia-1.7.0-rc3.sha256 -# this "case" statement is generated via "update.sh" - dpkgArch="$(dpkg --print-architecture)"; \ - case "${dpkgArch##*-}" in \ -# amd64 - amd64) tarArch='x86_64'; dirArch='x64'; sha256='cbf33c533d6f226161f08cdc3cec16745a3dc5afdfbaece95e3f2a5e0b6b7886' ;; \ -# arm32v7 - armhf) tarArch='armv7l'; dirArch='armv7l'; sha256='fff9370f58fd8f94f12a14d38c32d25b9e493d62a6d992edfc378caf9ef8d1cc' ;; \ -# arm64v8 - arm64) tarArch='aarch64'; dirArch='aarch64'; sha256='0662f9f31c87559ec33a24b3b83df85071357708287678ca78c7fa4498d05e5c' ;; \ -# i386 - i386) tarArch='i686'; dirArch='x86'; sha256='9ee7692faee05d7dbe431c59850542d95d260368bbf6d4f0ccdd03be07fef817' ;; \ - *) echo >&2 "error: current architecture ($dpkgArch) does not have a corresponding Julia binary release"; exit 1 ;; \ + arch="$(dpkg --print-architecture)"; \ + case "$arch" in \ + 'amd64') \ + url='https://julialang-s3.julialang.org/bin/linux/x64/1.7/julia-1.7.0-rc3-linux-x86_64.tar.gz'; \ + sha256='cbf33c533d6f226161f08cdc3cec16745a3dc5afdfbaece95e3f2a5e0b6b7886'; \ + ;; \ + 'armhf') \ + url='https://julialang-s3.julialang.org/bin/linux/armv7l/1.7/julia-1.7.0-rc3-linux-armv7l.tar.gz'; \ + sha256='fff9370f58fd8f94f12a14d38c32d25b9e493d62a6d992edfc378caf9ef8d1cc'; \ + ;; \ + 'arm64') \ + url='https://julialang-s3.julialang.org/bin/linux/aarch64/1.7/julia-1.7.0-rc3-linux-aarch64.tar.gz'; \ + sha256='0662f9f31c87559ec33a24b3b83df85071357708287678ca78c7fa4498d05e5c'; \ + ;; \ + 'i386') \ + url='https://julialang-s3.julialang.org/bin/linux/x86/1.7/julia-1.7.0-rc3-linux-i686.tar.gz'; \ + sha256='9ee7692faee05d7dbe431c59850542d95d260368bbf6d4f0ccdd03be07fef817'; \ + ;; \ + *) \ + echo >&2 "error: current architecture ($arch) does not have a corresponding Julia binary release"; \ + exit 1; \ + ;; \ esac; \ \ - folder="$(echo "$JULIA_VERSION" | cut -d. -f1-2)"; \ - curl -fL -o julia.tar.gz.asc "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${folder}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz.asc"; \ - curl -fL -o julia.tar.gz "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${folder}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz"; \ + curl -fL -o julia.tar.gz.asc "$url.asc"; \ + curl -fL -o julia.tar.gz "$url"; \ \ - echo "${sha256} *julia.tar.gz" | sha256sum -c -; \ + echo "$sha256 *julia.tar.gz" | sha256sum --strict --check -; \ \ export GNUPGHOME="$(mktemp -d)"; \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$JULIA_GPG"; \ diff --git a/1.7-rc/windows/windowsservercore-1809/Dockerfile b/1.7-rc/windows/windowsservercore-1809/Dockerfile index be979ea9..3bffdbcc 100644 --- a/1.7-rc/windows/windowsservercore-1809/Dockerfile +++ b/1.7-rc/windows/windowsservercore-1809/Dockerfile @@ -1,15 +1,21 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM mcr.microsoft.com/windows/servercore:1809 # $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] ENV JULIA_VERSION 1.7.0-rc3 +ENV JULIA_URL https://julialang-s3.julialang.org/bin/winnt/x64/1.7/julia-1.7.0-rc3-win64.exe ENV JULIA_SHA256 d48563b3faeeb0d937177f989f5c8bfe79552ac11255000870ce770a97c69de8 -RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win64.exe' -f $env:JULIA_VERSION, ($env:JULIA_VERSION.Split('.')[0..1] -Join '.')); \ - Write-Host ('Downloading {0} ...' -f $url); \ +RUN Write-Host ('Downloading {0} ...' -f $env:JULIA_URL); \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ - Invoke-WebRequest -Uri $url -OutFile 'julia.exe'; \ + Invoke-WebRequest -Uri $env:JULIA_URL -OutFile 'julia.exe'; \ \ Write-Host ('Verifying sha256 ({0}) ...' -f $env:JULIA_SHA256); \ if ((Get-FileHash julia.exe -Algorithm sha256).Hash -ne $env:JULIA_SHA256) { \ @@ -25,6 +31,9 @@ RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win6 '/DIR=C:\julia' \ ); \ \ + Write-Host 'Removing ...'; \ + Remove-Item julia.exe -Force; \ + \ Write-Host 'Updating PATH ...'; \ $env:PATH = 'C:\julia\bin;' + $env:PATH; \ [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \ @@ -32,9 +41,6 @@ RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win6 Write-Host 'Verifying install ("julia --version") ...'; \ julia --version; \ \ - Write-Host 'Removing ...'; \ - Remove-Item julia.exe -Force; \ - \ Write-Host 'Complete.' CMD ["julia"] diff --git a/1.7-rc/windows/windowsservercore-ltsc2016/Dockerfile b/1.7-rc/windows/windowsservercore-ltsc2016/Dockerfile index 0a32c8d7..b5cdc467 100644 --- a/1.7-rc/windows/windowsservercore-ltsc2016/Dockerfile +++ b/1.7-rc/windows/windowsservercore-ltsc2016/Dockerfile @@ -1,15 +1,21 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM mcr.microsoft.com/windows/servercore:ltsc2016 # $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] ENV JULIA_VERSION 1.7.0-rc3 +ENV JULIA_URL https://julialang-s3.julialang.org/bin/winnt/x64/1.7/julia-1.7.0-rc3-win64.exe ENV JULIA_SHA256 d48563b3faeeb0d937177f989f5c8bfe79552ac11255000870ce770a97c69de8 -RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win64.exe' -f $env:JULIA_VERSION, ($env:JULIA_VERSION.Split('.')[0..1] -Join '.')); \ - Write-Host ('Downloading {0} ...' -f $url); \ +RUN Write-Host ('Downloading {0} ...' -f $env:JULIA_URL); \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ - Invoke-WebRequest -Uri $url -OutFile 'julia.exe'; \ + Invoke-WebRequest -Uri $env:JULIA_URL -OutFile 'julia.exe'; \ \ Write-Host ('Verifying sha256 ({0}) ...' -f $env:JULIA_SHA256); \ if ((Get-FileHash julia.exe -Algorithm sha256).Hash -ne $env:JULIA_SHA256) { \ @@ -25,6 +31,9 @@ RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win6 '/DIR=C:\julia' \ ); \ \ + Write-Host 'Removing ...'; \ + Remove-Item julia.exe -Force; \ + \ Write-Host 'Updating PATH ...'; \ $env:PATH = 'C:\julia\bin;' + $env:PATH; \ [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \ @@ -32,9 +41,6 @@ RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win6 Write-Host 'Verifying install ("julia --version") ...'; \ julia --version; \ \ - Write-Host 'Removing ...'; \ - Remove-Item julia.exe -Force; \ - \ Write-Host 'Complete.' CMD ["julia"] diff --git a/1.7-rc/windows/windowsservercore-ltsc2022/Dockerfile b/1.7-rc/windows/windowsservercore-ltsc2022/Dockerfile index 9108017f..1d89981c 100644 --- a/1.7-rc/windows/windowsservercore-ltsc2022/Dockerfile +++ b/1.7-rc/windows/windowsservercore-ltsc2022/Dockerfile @@ -1,15 +1,21 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM mcr.microsoft.com/windows/servercore:ltsc2022 # $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] ENV JULIA_VERSION 1.7.0-rc3 +ENV JULIA_URL https://julialang-s3.julialang.org/bin/winnt/x64/1.7/julia-1.7.0-rc3-win64.exe ENV JULIA_SHA256 d48563b3faeeb0d937177f989f5c8bfe79552ac11255000870ce770a97c69de8 -RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win64.exe' -f $env:JULIA_VERSION, ($env:JULIA_VERSION.Split('.')[0..1] -Join '.')); \ - Write-Host ('Downloading {0} ...' -f $url); \ +RUN Write-Host ('Downloading {0} ...' -f $env:JULIA_URL); \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ - Invoke-WebRequest -Uri $url -OutFile 'julia.exe'; \ + Invoke-WebRequest -Uri $env:JULIA_URL -OutFile 'julia.exe'; \ \ Write-Host ('Verifying sha256 ({0}) ...' -f $env:JULIA_SHA256); \ if ((Get-FileHash julia.exe -Algorithm sha256).Hash -ne $env:JULIA_SHA256) { \ @@ -25,6 +31,9 @@ RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win6 '/DIR=C:\julia' \ ); \ \ + Write-Host 'Removing ...'; \ + Remove-Item julia.exe -Force; \ + \ Write-Host 'Updating PATH ...'; \ $env:PATH = 'C:\julia\bin;' + $env:PATH; \ [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \ @@ -32,9 +41,6 @@ RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win6 Write-Host 'Verifying install ("julia --version") ...'; \ julia --version; \ \ - Write-Host 'Removing ...'; \ - Remove-Item julia.exe -Force; \ - \ Write-Host 'Complete.' CMD ["julia"] diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template deleted file mode 100644 index f102cc42..00000000 --- a/Dockerfile-alpine.template +++ /dev/null @@ -1,43 +0,0 @@ -FROM alpine:%%TAG%% - -ENV JULIA_PATH /usr/local/julia -ENV PATH $JULIA_PATH/bin:$PATH - -# https://julialang.org/juliareleases.asc -# Julia (Binary signing key) -ENV JULIA_GPG 3673DF529D9049477F76B37566E3C7DC03D6E495 - -# https://julialang.org/downloads/ -ENV JULIA_VERSION %%JULIA_VERSION%% - -RUN set -eux; \ - \ - apk add --no-cache --virtual .fetch-deps gnupg; \ - \ -# https://julialang.org/downloads/#julia-command-line-version -# https://julialang-s3.julialang.org/bin/checksums/julia-%%JULIA_VERSION%%.sha256 -# this "case" statement is generated via "update.sh" - %%ARCH-CASE%%; \ - \ - folder="$(echo "$JULIA_VERSION" | cut -d. -f1-2)"; \ - wget -O julia.tar.gz.asc "https://julialang-s3.julialang.org/bin/musl/${dirArch}/${folder}/julia-${JULIA_VERSION}-musl-${tarArch}.tar.gz.asc"; \ - wget -O julia.tar.gz "https://julialang-s3.julialang.org/bin/musl/${dirArch}/${folder}/julia-${JULIA_VERSION}-musl-${tarArch}.tar.gz"; \ - \ - echo "${sha256} *julia.tar.gz" | sha256sum -c -; \ - \ - export GNUPGHOME="$(mktemp -d)"; \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$JULIA_GPG"; \ - gpg --batch --verify julia.tar.gz.asc julia.tar.gz; \ - command -v gpgconf > /dev/null && gpgconf --kill all; \ - rm -rf "$GNUPGHOME" julia.tar.gz.asc; \ - \ - mkdir "$JULIA_PATH"; \ - tar -xzf julia.tar.gz -C "$JULIA_PATH" --strip-components 1; \ - rm julia.tar.gz; \ - \ - apk del --no-network .fetch-deps; \ - \ -# smoke test - julia --version - -CMD ["julia"] diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template deleted file mode 100644 index 0a691755..00000000 --- a/Dockerfile-debian.template +++ /dev/null @@ -1,62 +0,0 @@ -FROM debian:%%TAG%% - -RUN set -eux; \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - ca-certificates \ -# ERROR: no download agent available; install curl, wget, or fetch - curl \ - ; \ - rm -rf /var/lib/apt/lists/* - -ENV JULIA_PATH /usr/local/julia -ENV PATH $JULIA_PATH/bin:$PATH - -# https://julialang.org/juliareleases.asc -# Julia (Binary signing key) -ENV JULIA_GPG 3673DF529D9049477F76B37566E3C7DC03D6E495 - -# https://julialang.org/downloads/ -ENV JULIA_VERSION %%JULIA_VERSION%% - -RUN set -eux; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - if ! command -v gpg > /dev/null; then \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - gnupg \ - dirmngr \ - ; \ - rm -rf /var/lib/apt/lists/*; \ - fi; \ - \ -# https://julialang.org/downloads/#julia-command-line-version -# https://julialang-s3.julialang.org/bin/checksums/julia-%%JULIA_VERSION%%.sha256 -# this "case" statement is generated via "update.sh" - %%ARCH-CASE%%; \ - \ - folder="$(echo "$JULIA_VERSION" | cut -d. -f1-2)"; \ - curl -fL -o julia.tar.gz.asc "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${folder}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz.asc"; \ - curl -fL -o julia.tar.gz "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${folder}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz"; \ - \ - echo "${sha256} *julia.tar.gz" | sha256sum -c -; \ - \ - export GNUPGHOME="$(mktemp -d)"; \ - gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$JULIA_GPG"; \ - gpg --batch --verify julia.tar.gz.asc julia.tar.gz; \ - command -v gpgconf > /dev/null && gpgconf --kill all; \ - rm -rf "$GNUPGHOME" julia.tar.gz.asc; \ - \ - mkdir "$JULIA_PATH"; \ - tar -xzf julia.tar.gz -C "$JULIA_PATH" --strip-components 1; \ - rm julia.tar.gz; \ - \ - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - \ -# smoke test - julia --version - -CMD ["julia"] diff --git a/Dockerfile-linux.template b/Dockerfile-linux.template new file mode 100644 index 00000000..48fe90a9 --- /dev/null +++ b/Dockerfile-linux.template @@ -0,0 +1,129 @@ +{{ + def is_alpine: + env.variant | startswith("alpine") + ; + def os_arches: + if is_alpine then + { + amd64: "x86_64", + arm32v6: "armhf", + arm32v7: "armv7", + arm64v8: "aarch64", + i386: "x86", + ppc64le: "ppc64le", + s390x: "s390x", + } + else + { + amd64: "amd64", + arm32v5: "armel", + arm32v7: "armhf", + arm64v8: "arm64", + i386: "i386", + mips64le: "mips64el", + ppc64le: "ppc64el", + s390x: "s390x", + } + end +-}} +{{ if is_alpine then ( -}} +FROM alpine:{{ env.variant | ltrimstr("alpine") }} +{{ ) else ( -}} +FROM debian:{{ env.variant }}-slim + +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + ca-certificates \ +# ERROR: no download agent available; install curl, wget, or fetch + curl \ + ; \ + rm -rf /var/lib/apt/lists/* +{{ ) end -}} + +ENV JULIA_PATH /usr/local/julia +ENV PATH $JULIA_PATH/bin:$PATH + +# https://julialang.org/juliareleases.asc +# Julia (Binary signing key) +ENV JULIA_GPG 3673DF529D9049477F76B37566E3C7DC03D6E495 + +# https://julialang.org/downloads/ +ENV JULIA_VERSION {{ .version }} + +RUN set -eux; \ + \ +{{ if is_alpine then ( -}} + apk add --no-cache --virtual .fetch-deps gnupg; \ +{{ ) else ( -}} + savedAptMark="$(apt-mark showmanual)"; \ + if ! command -v gpg > /dev/null; then \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + gnupg \ + dirmngr \ + ; \ + rm -rf /var/lib/apt/lists/*; \ + fi; \ +{{ ) end -}} + \ +# https://julialang.org/downloads/#julia-command-line-version +# https://julialang-s3.julialang.org/bin/checksums/julia-{{ .version }}.sha256 +{{ if is_alpine then ( -}} + arch="$(apk --print-arch)"; \ +{{ ) else ( -}} + arch="$(dpkg --print-architecture)"; \ +{{ ) end -}} + case "$arch" in \ +{{ + [ + .arches + | to_entries[] + | select(.key | if is_alpine then startswith("alpine-") else contains("-") | not end) + | (.key | ltrimstr("alpine-")) as $bashbrewArch + | (os_arches[$bashbrewArch] // empty) as $osArch + | .value + | ( +-}} + {{ $osArch | @sh }}) \ + url={{ .url | @sh }}; \ + sha256={{ .sha256 | @sh }}; \ + ;; \ +{{ + ) + ] | add +-}} + *) \ + echo >&2 "error: current architecture ($arch) does not have a corresponding Julia binary release"; \ + exit 1; \ + ;; \ + esac; \ + \ +{{ def wget: if is_alpine then "wget -O" else "curl -fL -o" end -}} + {{ wget }} julia.tar.gz.asc "$url.asc"; \ + {{ wget }} julia.tar.gz "$url"; \ + \ + echo "$sha256 *julia.tar.gz" | sha256sum {{ if is_alpine then "-w -c" else "--strict --check" end }} -; \ + \ + export GNUPGHOME="$(mktemp -d)"; \ + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$JULIA_GPG"; \ + gpg --batch --verify julia.tar.gz.asc julia.tar.gz; \ + command -v gpgconf > /dev/null && gpgconf --kill all; \ + rm -rf "$GNUPGHOME" julia.tar.gz.asc; \ + \ + mkdir "$JULIA_PATH"; \ + tar -xzf julia.tar.gz -C "$JULIA_PATH" --strip-components 1; \ + rm julia.tar.gz; \ + \ +{{ if is_alpine then ( -}} + apk del --no-network .fetch-deps; \ +{{ ) else ( -}} + apt-mark auto '.*' > /dev/null; \ + [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ +{{ ) end -}} + \ +# smoke test + julia --version + +CMD ["julia"] diff --git a/Dockerfile-windowsservercore.template b/Dockerfile-windows-servercore.template similarity index 66% rename from Dockerfile-windowsservercore.template rename to Dockerfile-windows-servercore.template index 1ed8fd4c..9da3f16e 100644 --- a/Dockerfile-windowsservercore.template +++ b/Dockerfile-windows-servercore.template @@ -1,15 +1,15 @@ -FROM mcr.microsoft.com/windows/servercore:%%TAG%% +FROM mcr.microsoft.com/windows/{{ env.windowsVariant }}:{{ env.windowsRelease }} # $ProgressPreference: https://github.com/PowerShell/PowerShell/issues/2138#issuecomment-251261324 SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] -ENV JULIA_VERSION %%JULIA_VERSION%% -ENV JULIA_SHA256 %%JULIA_WINDOWS_SHA256%% +ENV JULIA_VERSION {{ .version }} +ENV JULIA_URL {{ .arches["windows-amd64"].url }} +ENV JULIA_SHA256 {{ .arches["windows-amd64"].sha256 }} -RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win64.exe' -f $env:JULIA_VERSION, ($env:JULIA_VERSION.Split('.')[0..1] -Join '.')); \ - Write-Host ('Downloading {0} ...' -f $url); \ +RUN Write-Host ('Downloading {0} ...' -f $env:JULIA_URL); \ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ - Invoke-WebRequest -Uri $url -OutFile 'julia.exe'; \ + Invoke-WebRequest -Uri $env:JULIA_URL -OutFile 'julia.exe'; \ \ Write-Host ('Verifying sha256 ({0}) ...' -f $env:JULIA_SHA256); \ if ((Get-FileHash julia.exe -Algorithm sha256).Hash -ne $env:JULIA_SHA256) { \ @@ -21,10 +21,21 @@ RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win6 Start-Process -Wait -NoNewWindow \ -FilePath '.\julia.exe' \ -ArgumentList @( \ +{{ + # https://github.com/JuliaLang/julia/blob/v1.4.0-rc1/NEWS.md#build-system-changes + if env.version == "1.0" then ( +-}} + '/S', \ + '/D=C:\julia' \ +{{ ) else ( -}} '/SILENT', \ '/DIR=C:\julia' \ +{{ ) end -}} ); \ \ + Write-Host 'Removing ...'; \ + Remove-Item julia.exe -Force; \ + \ Write-Host 'Updating PATH ...'; \ $env:PATH = 'C:\julia\bin;' + $env:PATH; \ [Environment]::SetEnvironmentVariable('PATH', $env:PATH, [EnvironmentVariableTarget]::Machine); \ @@ -32,9 +43,6 @@ RUN $url = ('https://julialang-s3.julialang.org/bin/winnt/x64/{1}/julia-{0}-win6 Write-Host 'Verifying install ("julia --version") ...'; \ julia --version; \ \ - Write-Host 'Removing ...'; \ - Remove-Item julia.exe -Force; \ - \ Write-Host 'Complete.' CMD ["julia"] diff --git a/apply-templates.sh b/apply-templates.sh new file mode 100755 index 00000000..db2b16cd --- /dev/null +++ b/apply-templates.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +[ -f versions.json ] # run "versions.sh" first + +jqt='.jq-template.awk' +if [ -n "${BASHBREW_SCRIPTS:-}" ]; then + jqt="$BASHBREW_SCRIPTS/jq-template.awk" +elif [ "$BASH_SOURCE" -nt "$jqt" ]; then + # https://github.com/docker-library/bashbrew/blob/master/scripts/jq-template.awk + wget -qO "$jqt" 'https://github.com/docker-library/bashbrew/raw/1da7341a79651d28fbcc3d14b9176593c4231942/scripts/jq-template.awk' +fi + +if [ "$#" -eq 0 ]; then + versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)" + eval "set -- $versions" +fi + +generated_warning() { + cat <<-EOH + # + # NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh" + # + # PLEASE DO NOT EDIT IT DIRECTLY. + # + + EOH +} + +for version; do + export version + + rm -rf "$version/" + + variants="$(jq -r '.[env.version].variants | map(@sh) | join(" ")' versions.json)" + eval "variants=( $variants )" + + for dir in "${variants[@]}"; do + mkdir -p "$version/$dir" + + variant="$(basename "$dir")" # "buster", "windowsservercore-1809", etc + export variant + + case "$dir" in + windows/*) + windowsVariant="${variant%%-*}" # "windowsservercore", "nanoserver" + windowsRelease="${variant#$windowsVariant-}" # "1809", "ltsc2016", etc + windowsVariant="${windowsVariant#windows}" # "servercore", "nanoserver" + export windowsVariant windowsRelease + template="Dockerfile-windows-$windowsVariant.template" + ;; + + *) + template='Dockerfile-linux.template' + ;; + esac + + echo "processing $version/$dir ..." + + { + generated_warning + gawk -f "$jqt" "$template" + } > "$version/$dir/Dockerfile" + done +done diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index d9039a3d..b940b472 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -4,17 +4,17 @@ set -Eeuo pipefail declare -A aliases=( [1.6]='1 latest' ) -defaultDebianVariant='bullseye' -defaultAlpineVariant='alpine3.15' self="$(basename "$BASH_SOURCE")" cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" -versions=( */ ) -versions=( "${versions[@]%/}" ) +if [ "$#" -eq 0 ]; then + versions="$(jq -r 'keys | map(@sh) | join(" ")' versions.json)" + eval "set -- $versions" +fi # sort version numbers with highest first -IFS=$'\n'; versions=( $(echo "${versions[*]}" | sort -rV) ); unset IFS +IFS=$'\n'; set -- $(sort -rV <<<"$*"); unset IFS # get the most recent commit which modified any of "$@" fileCommit() { @@ -26,15 +26,19 @@ dirCommit() { local dir="$1"; shift ( cd "$dir" - fileCommit \ - Dockerfile \ - $(git show HEAD:./Dockerfile | awk ' + files="$( + git show HEAD:./Dockerfile | awk ' toupper($1) == "COPY" { for (i = 2; i < NF; i++) { + if ($i ~ /^--from=/) { + next + } print $i } } - ') + ' + )" + fileCommit Dockerfile $files ) } @@ -54,24 +58,6 @@ getArches() { } getArches 'julia' -source '.architectures-lib' - -parentArches() { - local version="$1"; shift # "1.8", etc - local dir="$1"; shift # "1.8/windows/windowsservercore-ltsc2016" - - local parent="$(awk 'toupper($1) == "FROM" { print $2 }' "$dir/Dockerfile")" - local parentArches="${parentRepoToArches[$parent]:-}" - - local arches=() - for arch in $parentArches; do - if hasBashbrewArch "$version" "$arch" && grep -qE "^# $arch\$" "$dir/Dockerfile"; then - arches+=( "$arch" ) - fi - done - echo "${arches[*]}" -} - cat <<-EOH # this file is generated via https://github.com/docker-library/julia/blob/$(fileCommit "$self")/$self @@ -87,46 +73,97 @@ join() { echo "${out#$sep}" } -for version in "${versions[@]}"; do - for v in \ - {bullseye,buster} \ - alpine{3.15,3.14} \ - windows/windowsservercore-{ltsc2022,1809,ltsc2016} \ - ; do - dir="$version/$v" - dir="${dir#./}" - variant="$(basename "$v")" +for version; do + export version + variants="$(jq -r '.[env.version].variants | map(@sh) | join(" ")' versions.json)" + eval "variants=( $variants )" - [ -f "$dir/Dockerfile" ] || continue + fullVersion="$(jq -r '.[env.version].version' versions.json)" - commit="$(dirCommit "$dir")" + versionAliases=( + $fullVersion + $version + ${aliases[$version]:-} + ) - fullVersion="$(git show "$commit":"$dir/Dockerfile" | awk '$1 == "ENV" && $2 == "JULIA_VERSION" { print $3; exit }')" + defaultDebianVariant="$(jq -r ' + .[env.version].variants + | map(select( + startswith("alpine") + or startswith("windows/") + | not + )) + | .[0] + ' versions.json)" + defaultAlpineVariant="$(jq -r ' + .[env.version].variants + | map(select( + startswith("alpine") + )) + | .[0] + ' versions.json)" + + for v in "${variants[@]}"; do + dir="$version/$v" + [ -f "$dir/Dockerfile" ] || continue + variant="$(basename "$v")" + export variant - versionAliases=() - while [ "$fullVersion" != "$version" -a "${fullVersion%[.-]*}" != "$fullVersion" ]; do - versionAliases+=( $fullVersion ) - fullVersion="${fullVersion%[.-]*}" - done - versionAliases+=( - $version - ${aliases[$version]:-} - ) + commit="$(dirCommit "$dir")" variantAliases=( "${versionAliases[@]/%/-$variant}" ) - if [ "$variant" = "$defaultAlpineVariant" ]; then - variantAliases+=( "${versionAliases[@]/%/-alpine}" ) - fi + sharedTags=() + case "$variant" in + "$defaultDebianVariant" | windowsservercore-*) + sharedTags=( "${versionAliases[@]}" ) + ;; + "$defaultAlpineVariant") + variantAliases+=( "${versionAliases[@]/%/-alpine}" ) + ;; + esac variantAliases=( "${variantAliases[@]//latest-/}" ) - sharedTags=() - if [ "$variant" = "$defaultDebianVariant" ] || [[ "$variant" == 'windowsservercore'* ]]; then - sharedTags+=( "${versionAliases[@]}" ) - fi + for windowsShared in windowsservercore nanoserver; do + if [[ "$variant" == "$windowsShared"* ]]; then + sharedTags+=( "${versionAliases[@]/%/-$windowsShared}" ) + sharedTags=( "${sharedTags[@]//latest-/}" ) + break + fi + done + constraints= case "$v" in - windows/*) variantArches='windows-amd64' ;; - *) variantArches="$(parentArches "$version" "$dir")" ;; + windows/*) + variantArches="$(jq -r ' + .[env.version].arches + | keys[] + | select(startswith("windows-")) + | select(. != "windows-i386") # TODO "windows-arm64v8" someday? 👀 + ' versions.json | sort)" + constraints="$variant" + ;; + + *) + variantParent="$(awk 'toupper($1) == "FROM" { print $2; exit }' "$dir/Dockerfile")" + variantArches="${parentRepoToArches[$variantParent]:-}" + variantArches="$( + comm -12 \ + <( + jq -r ' + .[env.version].arches + | keys[] + | if env.variant | startswith("alpine") then + if startswith("alpine-") then + ltrimstr("alpine-") + else + empty + end + else . end + ' versions.json | sort + ) \ + <(xargs -n1 <<<"$variantArches" | sort) + )" + ;; esac echo @@ -139,6 +176,6 @@ for version in "${versions[@]}"; do GitCommit: $commit Directory: $dir EOE - [[ "$v" == windows/* ]] && echo "Constraints: $variant" + [ -z "$constraints" ] || echo "Constraints: $constraints" done done diff --git a/release-architectures b/release-architectures deleted file mode 100644 index 87752078..00000000 --- a/release-architectures +++ /dev/null @@ -1,8 +0,0 @@ -# see https://julialang.org/downloads/#julia-command-line-version - -# bashbrew-arch dpkg-arch julia-tar-arch julia-dir-arch -amd64 amd64 x86_64 x64 -arm32v7 armhf armv7l armv7l -arm64v8 arm64 aarch64 aarch64 -i386 i386 i686 x86 -ppc64le ppc64el ppc64le ppc64le diff --git a/update.sh b/update.sh index 29d839d9..bac2d758 100755 --- a/update.sh +++ b/update.sh @@ -1,120 +1,7 @@ #!/usr/bin/env bash set -Eeuo pipefail -# TODO https://julialang-s3.julialang.org/bin/versions.json ? -# delayed deploys: https://github.com/JuliaLang/julia/issues/38946#issuecomment-749224376 - cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" -versions=( "$@" ) -if [ ${#versions[@]} -eq 0 ]; then - versions=( */ ) -fi -versions=( "${versions[@]%/}" ) - -source '.architectures-lib' - -# see https://stackoverflow.com/a/2705678/433558 -sed_escape_rhs() { - echo "$@" | sed -e 's/[\/&]/\\&/g' | sed -e ':a;N;$!ba;s/\n/\\n/g' -} - -rcRegex='-(pre[.])?(alpha|beta|rc)[0-9]*' - -pattern='[^"]*/julia-([0-9]+\.[0-9]+\.[0-9]+('"$rcRegex"')?)-linux-x86_64\.tar\.gz[^"]*' -allVersions="$( - curl -fsSL 'https://julialang.org/downloads/' \ - | grep -oE "$pattern" \ - | sed -rn "s!${pattern}!\1!gp" \ - | sort -ruV -)" - -for version in "${versions[@]}"; do - rcVersion="${version%-rc}" - rcGrepV='-v' - if [ "$rcVersion" != "$version" ]; then - rcGrepV= - fi - rcGrepV+=' -E' - - fullVersion="$(grep -E "^${rcVersion}([.-]|$)" <<<"$allVersions" | grep $rcGrepV -- "$rcRegex" | head -1)" - if [ -z "$fullVersion" ]; then - echo >&2 "error: failed to determine latest release for '$version'" - exit 1 - fi - - sha256s="$(curl -fsSL "https://julialang-s3.julialang.org/bin/checksums/julia-${fullVersion}.sha256")" - - linuxArchCase='dpkgArch="$(dpkg --print-architecture)"; '$'\\\n' - linuxArchCase+=$'\t''case "${dpkgArch##*-}" in '$'\\\n' - for dpkgArch in $(dpkgArches "$version"); do - tarArch="$(dpkgToJuliaTarArch "$version" "$dpkgArch")" - dirArch="$(dpkgToJuliaDirArch "$version" "$dpkgArch")" - sha256="$(grep "julia-${fullVersion}-linux-${tarArch}.tar.gz$" <<<"$sha256s" | cut -d' ' -f1 || :)" - if [ -z "$sha256" ]; then - echo >&2 "warning: cannot find sha256 for $fullVersion on arch $tarArch / $dirArch ($dpkgArch); skipping" - continue - fi - bashbrewArch="$(dpkgToBashbrewArch "$version" "$dpkgArch")" - linuxArchCase+="# $bashbrewArch"$'\n' - linuxArchCase+=$'\t\t'"$dpkgArch) tarArch='$tarArch'; dirArch='$dirArch'; sha256='$sha256' ;; "$'\\\n' - done - linuxArchCase+=$'\t\t''*) echo >&2 "error: current architecture ($dpkgArch) does not have a corresponding Julia binary release"; exit 1 ;; '$'\\\n' - linuxArchCase+=$'\t''esac' - - winSha256="$(grep "julia-${fullVersion}-win64.exe$" <<<"$sha256s" | cut -d' ' -f1)" - - echo "$version: $fullVersion" - - for v in \ - windows/windowsservercore-{ltsc2022,1809,ltsc2016} \ - alpine{3.15,3.14} \ - {bullseye,buster} \ - ; do - dir="$version/$v" - variant="$(basename "$v")" - - [ -d "$dir" ] || continue - - case "$variant" in - windowsservercore-*) template='windowsservercore'; tag="${variant#*-}" ;; - alpine*) template='alpine'; tag="${variant#alpine}" ;; - *) template='debian'; tag="${variant}-slim" ;; - esac - - variantArchCase="$linuxArchCase" - if [ "$template" = 'alpine' ]; then - sha256="$(grep "julia-${fullVersion}-musl-x86_64.tar.gz$" <<<"$sha256s" | cut -d' ' -f1 || :)" - if [ -z "$sha256" ]; then - echo >&2 "error: missing musl build for $fullVersion ($version)!" - exit 1 - fi - variantArchCase='apkArch="$(apk --print-arch)"; '$'\\\n' - variantArchCase+=$'\t''case "$apkArch" in '$'\\\n' - # TODO Alpine multiarch - variantArchCase+='# amd64'$'\n' - tarArch="$(dpkgToJuliaTarArch "$version" 'amd64')" - dirArch="$(dpkgToJuliaDirArch "$version" 'amd64')" - variantArchCase+=$'\t\t'"x86_64) tarArch='$tarArch'; dirArch='$dirArch'; sha256='$sha256' ;; "$'\\\n' - variantArchCase+=$'\t\t''*) echo >&2 "error: current architecture ($apkArch) does not have a corresponding Julia binary release"; exit 1 ;; '$'\\\n' - variantArchCase+=$'\t''esac' - fi - - sed -r \ - -e 's!%%JULIA_VERSION%%!'"$fullVersion"'!g' \ - -e 's!%%TAG%%!'"$tag"'!g' \ - -e 's!%%JULIA_WINDOWS_SHA256%%!'"$winSha256"'!g' \ - -e 's!%%ARCH-CASE%%!'"$(sed_escape_rhs "$variantArchCase")"'!g' \ - "Dockerfile-$template.template" > "$dir/Dockerfile" - - case "$dir" in - 1.0/windows/*) - # https://github.com/JuliaLang/julia/blob/v1.4.0-rc1/NEWS.md#build-system-changes - sed -ri \ - -e 's!/SILENT!/S!g' \ - -e 's!/DIR=!/D=!g' \ - "$dir/Dockerfile" - ;; - esac - done -done +./versions.sh "$@" +./apply-templates.sh "$@" diff --git a/versions.json b/versions.json new file mode 100644 index 00000000..a6ff4e9e --- /dev/null +++ b/versions.json @@ -0,0 +1,150 @@ +{ + "1.0": { + "arches": { + "amd64": { + "sha256": "9dedd613777ba6ebd8aee5796915ff50aa6188ea03ed143cb687fc2aefd76b03", + "url": "https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.0.5-linux-x86_64.tar.gz" + }, + "arm32v7": { + "sha256": "cfb2712765db90f0e4fa27e57a88c6d994ebcf1781f8673ebb17b5df7962d0c5", + "url": "https://julialang-s3.julialang.org/bin/linux/armv7l/1.0/julia-1.0.5-linux-armv7l.tar.gz" + }, + "arm64v8": { + "sha256": "41cea1336ed8861413bb945740e567360e26f241eb3e10b3bb0fccd25655ed28", + "url": "https://julialang-s3.julialang.org/bin/linux/aarch64/1.0/julia-1.0.5-linux-aarch64.tar.gz" + }, + "darwin-amd64": { + "sha256": "1ff7bd41f396ba3f34dc17c26b78d11adeadfafdea537f7ad17020ef812a39a0", + "url": "https://julialang-s3.julialang.org/bin/mac/x64/1.0/julia-1.0.5-mac64.dmg" + }, + "freebsd-amd64": { + "sha256": "3bae7ac8afa972ba1febec208f4679430bfc61df85415588f6bb253415d661ac", + "url": "https://julialang-s3.julialang.org/bin/freebsd/x64/1.0/julia-1.0.5-freebsd-x86_64.tar.gz" + }, + "i386": { + "sha256": "67c8f31699b79df96ce95926a363cd24ffa5bb4d9a814e071b1e8c8ff33e5a8f", + "url": "https://julialang-s3.julialang.org/bin/linux/x86/1.0/julia-1.0.5-linux-i686.tar.gz" + }, + "windows-amd64": { + "sha256": "83c04bdc264e7ab87f4e22be9f3dff8c5a62a49c8edea6a0c85f4645d4cbac7a", + "url": "https://julialang-s3.julialang.org/bin/winnt/x64/1.0/julia-1.0.5-win64.exe" + }, + "windows-i386": { + "sha256": "16a26142e4d6fd85515ef896675fd09c1421761b8c6d19822851ec89b341b502", + "url": "https://julialang-s3.julialang.org/bin/winnt/x86/1.0/julia-1.0.5-win32.exe" + } + }, + "variants": [ + "bullseye", + "buster", + "windows/windowsservercore-ltsc2022", + "windows/windowsservercore-1809", + "windows/windowsservercore-ltsc2016" + ], + "version": "1.0.5" + }, + "1.6": { + "arches": { + "alpine-amd64": { + "sha256": "63f121dffa982ff9b53c7c8a334830e17e2c9d2efa79316a548d29f7f8925e66", + "url": "https://julialang-s3.julialang.org/bin/musl/x64/1.6/julia-1.6.4-musl-x86_64.tar.gz" + }, + "amd64": { + "sha256": "52244ae47697e8073dfbc9d1251b0422f0dbd1fbe1a41da4b9f7ddf0506b2132", + "url": "https://julialang-s3.julialang.org/bin/linux/x64/1.6/julia-1.6.4-linux-x86_64.tar.gz" + }, + "arm32v7": { + "sha256": "9ad3f6bd71eb6840d4cef1569855da20c0b4931a2bdf77703a64df672b0702a1", + "url": "https://julialang-s3.julialang.org/bin/linux/armv7l/1.6/julia-1.6.4-linux-armv7l.tar.gz" + }, + "arm64v8": { + "sha256": "072daac7229c15fa41d0c1b65b8a3d6ee747323d02f5943da3846b075291b48b", + "url": "https://julialang-s3.julialang.org/bin/linux/aarch64/1.6/julia-1.6.4-linux-aarch64.tar.gz" + }, + "darwin-amd64": { + "sha256": "a00598f04832b8f5d28039942280feadf40e8a14d7f6264c754ec70627507ace", + "url": "https://julialang-s3.julialang.org/bin/mac/x64/1.6/julia-1.6.4-mac64.dmg" + }, + "freebsd-amd64": { + "sha256": "2a28938404103e0b7e77839308b49036f742b14d8a95da00c119d2db6e6fbfd7", + "url": "https://julialang-s3.julialang.org/bin/freebsd/x64/1.6/julia-1.6.4-freebsd-x86_64.tar.gz" + }, + "i386": { + "sha256": "9d43d642174cf22cf0fde18dc2578c84f357d2c619b9d846d3a6da4192ba48cf", + "url": "https://julialang-s3.julialang.org/bin/linux/x86/1.6/julia-1.6.4-linux-i686.tar.gz" + }, + "windows-amd64": { + "sha256": "c9b6ecdad4feb57e5af12c9ef1a74993a96edbf87a4dc521d57e338397cee9b2", + "url": "https://julialang-s3.julialang.org/bin/winnt/x64/1.6/julia-1.6.4-win64.exe" + }, + "windows-i386": { + "sha256": "cd41b60beae2664f4ac9e9f30ca9f852aebc3ef00f393b26f126f5861695790d", + "url": "https://julialang-s3.julialang.org/bin/winnt/x86/1.6/julia-1.6.4-win32.exe" + } + }, + "variants": [ + "bullseye", + "buster", + "alpine3.15", + "alpine3.14", + "windows/windowsservercore-ltsc2022", + "windows/windowsservercore-1809", + "windows/windowsservercore-ltsc2016" + ], + "version": "1.6.4" + }, + "1.7-rc": { + "arches": { + "alpine-amd64": { + "sha256": "68dc3d7b17fbcceea383b48d82c63c36b899e05f5cd7537a730d7578f65c40ea", + "url": "https://julialang-s3.julialang.org/bin/musl/x64/1.7/julia-1.7.0-rc3-musl-x86_64.tar.gz" + }, + "amd64": { + "sha256": "cbf33c533d6f226161f08cdc3cec16745a3dc5afdfbaece95e3f2a5e0b6b7886", + "url": "https://julialang-s3.julialang.org/bin/linux/x64/1.7/julia-1.7.0-rc3-linux-x86_64.tar.gz" + }, + "arm32v7": { + "sha256": "fff9370f58fd8f94f12a14d38c32d25b9e493d62a6d992edfc378caf9ef8d1cc", + "url": "https://julialang-s3.julialang.org/bin/linux/armv7l/1.7/julia-1.7.0-rc3-linux-armv7l.tar.gz" + }, + "arm64v8": { + "sha256": "0662f9f31c87559ec33a24b3b83df85071357708287678ca78c7fa4498d05e5c", + "url": "https://julialang-s3.julialang.org/bin/linux/aarch64/1.7/julia-1.7.0-rc3-linux-aarch64.tar.gz" + }, + "darwin-amd64": { + "sha256": "16bc2f2c6fa901f8f40de0a8628eb8ac792d6b967b2277818ca5532b40acae84", + "url": "https://julialang-s3.julialang.org/bin/mac/x64/1.7/julia-1.7.0-rc3-mac64.dmg" + }, + "darwin-arm64v8": { + "sha256": "4679b44c194c004037684c6dade8b988968b90adefee4d9483d8f82c61c3aa2b", + "url": "https://julialang-s3.julialang.org/bin/mac/aarch64/1.7/julia-1.7.0-rc3-macaarch64.dmg" + }, + "freebsd-amd64": { + "sha256": "0ba30a862e990d27961d5c01952cef141bce99774f2e5a3a0a36f42b6c2173bb", + "url": "https://julialang-s3.julialang.org/bin/freebsd/x64/1.7/julia-1.7.0-rc3-freebsd-x86_64.tar.gz" + }, + "i386": { + "sha256": "9ee7692faee05d7dbe431c59850542d95d260368bbf6d4f0ccdd03be07fef817", + "url": "https://julialang-s3.julialang.org/bin/linux/x86/1.7/julia-1.7.0-rc3-linux-i686.tar.gz" + }, + "windows-amd64": { + "sha256": "d48563b3faeeb0d937177f989f5c8bfe79552ac11255000870ce770a97c69de8", + "url": "https://julialang-s3.julialang.org/bin/winnt/x64/1.7/julia-1.7.0-rc3-win64.exe" + }, + "windows-i386": { + "sha256": "fb643f5128f92213a9d704186450a170a57e9975f8c307a0057ca6f18b499914", + "url": "https://julialang-s3.julialang.org/bin/winnt/x86/1.7/julia-1.7.0-rc3-win32.exe" + } + }, + "variants": [ + "bullseye", + "buster", + "alpine3.15", + "alpine3.14", + "windows/windowsservercore-ltsc2022", + "windows/windowsservercore-1809", + "windows/windowsservercore-ltsc2016" + ], + "version": "1.7.0-rc3" + } +} diff --git a/versions.sh b/versions.sh new file mode 100755 index 00000000..1bb41ab4 --- /dev/null +++ b/versions.sh @@ -0,0 +1,108 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" + +versions=( "$@" ) +if [ ${#versions[@]} -eq 0 ]; then + versions=( */ ) + json='{}' +else + json="$(< versions.json)" +fi +versions=( "${versions[@]%/}" ) + +# https://julialang.org/downloads/#json_release_feed +# https://julialang-s3.julialang.org/bin/versions.json +# https://julialang-s3.julialang.org/bin/versions-schema.json +juliaVersions="$( + wget -qO- 'https://julialang-s3.julialang.org/bin/versions.json' | jq -c ' + [ + to_entries[] + | .key as $version + | .value + | ( + ($version | sub("^(?[0-9]+[.][0-9]+).*$"; "\(.m)")) + + if .stable then "" else "-rc" end + ) as $major + | { + version: $version, + major: $major, + arches: (.files | map( + # map values from the julia versions-schema.json to bashbrew architecture values + # (plus some extra fiddly bits for Alpine) + { + mac: "darwin", + winnt: "windows", + linux: ( + if .triplet | endswith("-musl") then + "alpine" + else + "linux" + end + ), + freebsd: "freebsd", + }[.os] as $os + | { + x86_64: "amd64", + i686: "i386", + powerpc64le: "ppc64le", + aarch64: "arm64v8", + armv7l: "arm32v7", + }[.arch] as $arch + | if $os == null or $arch == null then empty + elif .kind != (if $os == "windows" then "installer" else "archive" end) then empty + else { + key: ( + if $os == "linux" then "" else $os + "-" end + + $arch + ), + value: { + url: .url, + sha256: .sha256, + }, + } end + ) | from_entries), + } + ] | sort_by([.major, .version] | map(split("[.-]"; "") | map(if test("^[0-9]+$") then tonumber else . end))) + ' +)" + +for version in "${versions[@]}"; do + export version + + if \ + ! doc="$(jq <<<"$juliaVersions" -c ' + [ .[] | select(.major == env.version) ][-1] + ')" \ + || ! fullVersion="$(jq <<<"$doc" -r '.version')" \ + || [ -z "$fullVersion" ] \ + ; then + echo >&2 "warning: cannot find full version for $version" + continue + fi + + echo "$version: $fullVersion" + + json="$(jq <<<"$json" -c --argjson doc "$doc" '.[env.version] = ( + $doc + | del(.major) + | .variants = ([ + "bullseye", + "buster", + if .arches | keys | any(startswith("alpine-")) then + "3.15", + "3.14" + | "alpine" + . + else empty end, + if .arches | has("windows-amd64") then + "ltsc2022", + "1809", + "ltsc2016" + | "windows/windowsservercore-" + . + else empty end + ]) + )')" +done + +jq <<<"$json" -S . > versions.json