Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Alpine-based Julia 1.5 image #47

Merged
merged 3 commits into from
Jun 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
git clone --depth 1 https://github.com/docker-library/bashbrew.git -b master ~/bashbrew
strategy="$(~/bashbrew/scripts/github-actions/generate.sh)"
strategy="$(~/bashbrew/scripts/github-actions/munge-i386.sh -c <<<"$strategy")"
strategy="$(jq -c <<<"$strategy" '.matrix.include = [ .matrix.include[] | select(.name | test("alpine.*i386") | not) ]')" # Alpine releases do not exist for i386
jq . <<<"$strategy" # sanity check / debugging aid
echo "::set-output name=strategy::$strategy"

Expand Down
48 changes: 48 additions & 0 deletions 1.5-rc/alpine3.12/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
FROM alpine:3.12

ENV JULIA_PATH /usr/local/julia
ENV PATH $JULIA_PATH/bin:$PATH

# https://julialang.org/juliareleases.asc
# Julia (Binary signing key) <[email protected]>
ENV JULIA_GPG 3673DF529D9049477F76B37566E3C7DC03D6E495

# https://julialang.org/downloads/
ENV JULIA_VERSION 1.5.0-rc1

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-1.5.0-rc1.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='43e3a30133aee14657cc8984cc51e8f308ac1978e4c5986f4c976b8e8747194f' ;; \
*) echo >&2 "error: current architecture ($apkArch) 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"; \
\
echo "${sha256} *julia.tar.gz" | sha256sum -c -; \
\
export GNUPGHOME="$(mktemp -d)"; \
gpg --batch --keyserver ha.pool.sks-keyservers.net --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"]
43 changes: 43 additions & 0 deletions Dockerfile-alpine.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM alpine:%%TAG%%

ENV JULIA_PATH /usr/local/julia
ENV PATH $JULIA_PATH/bin:$PATH

# https://julialang.org/juliareleases.asc
# Julia (Binary signing key) <[email protected]>
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 ha.pool.sks-keyservers.net --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"]
5 changes: 5 additions & 0 deletions generate-stackbrew-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ declare -A aliases=(
[1.5-rc]='rc'
)
defaultDebianVariant='buster'
defaultAlpineVariant='alpine3.12'

self="$(basename "$BASH_SOURCE")"
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
Expand Down Expand Up @@ -90,6 +91,7 @@ join() {
for version in "${versions[@]}"; do
for v in \
{buster,stretch} \
alpine3.12 \
windows/windowsservercore-{ltsc2016,1809} \
; do
dir="$version/$v"
Expand All @@ -113,6 +115,9 @@ for version in "${versions[@]}"; do
)

variantAliases=( "${versionAliases[@]/%/-$variant}" )
if [ "$variant" = "$defaultAlpineVariant" ]; then
variantAliases+=( "${versionAliases[@]/%/-alpine}" )
fi
variantAliases=( "${variantAliases[@]//latest-/}" )

sharedTags=()
Expand Down
23 changes: 20 additions & 3 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ for version in "${versions[@]}"; do
for dpkgArch in $(dpkgArches "$version"); do
tarArch="$(dpkgToJuliaTarArch "$version" "$dpkgArch")"
dirArch="$(dpkgToJuliaDirArch "$version" "$dpkgArch")"
sha256="$(echo "$sha256s" | grep "julia-${fullVersion}-linux-${tarArch}.tar.gz$" | cut -d' ' -f1 || :)"
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
Expand All @@ -59,12 +59,13 @@ for version in "${versions[@]}"; do
linuxArchCase+=$'\t\t''*) echo >&2 "error: current architecture ($dpkgArch) does not have a corresponding Julia binary release"; exit 1 ;; '$'\\\n'
linuxArchCase+=$'\t''esac'

winSha256="$(echo "$sha256s" | grep "julia-${fullVersion}-win64.exe$" | cut -d' ' -f1)"
winSha256="$(grep "julia-${fullVersion}-win64.exe$" <<<"$sha256s" | cut -d' ' -f1)"

echo "$version: $fullVersion"

for v in \
windows/windowsservercore-{ltsc2016,1809} \
alpine3.12 \
{stretch,buster} \
; do
dir="$version/$v"
Expand All @@ -74,6 +75,7 @@ for version in "${versions[@]}"; do

case "$variant" in
windowsservercore-*) template='windowsservercore'; tag="${variant#*-}" ;;
alpine*) template='alpine'; tag="${variant#alpine}" ;;
*) template='debian'; tag="${variant}-slim" ;;
esac

Expand All @@ -82,11 +84,26 @@ for version in "${versions[@]}"; do
tag="$variant"
fi

variantArchCase="$linuxArchCase"
if [ "$template" = 'alpine' ]; then
sha256="$(grep "julia-${fullVersion}-musl-x86_64.tar.gz$" <<<"$sha256s" | cut -d' ' -f1 || :)"
[ -n "$sha256" ] || continue
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 "$linuxArchCase")"'!g' \
-e 's!%%ARCH-CASE%%!'"$(sed_escape_rhs "$variantArchCase")"'!g' \
"Dockerfile-$template.template" > "$dir/Dockerfile"

case "$dir" in
Expand Down