-
Notifications
You must be signed in to change notification settings - Fork 30
Add support for multiple architectures #15
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
|
||
_awkArch() { | ||
local version="$1"; shift | ||
local awkExpr="$1"; shift | ||
awk "$@" "/^#|^\$/ { next } $awkExpr" "$version/release-architectures" | ||
} | ||
|
||
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" | ||
} | ||
|
||
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" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,46 @@ | ||
FROM debian:jessie | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends ca-certificates \ | ||
&& apt-get install -y --no-install-recommends \ | ||
ca-certificates \ | ||
curl \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
ENV JULIA_PATH /usr/local/julia | ||
ENV JULIA_VERSION 0.6.0 | ||
|
||
RUN mkdir $JULIA_PATH \ | ||
&& apt-get update && apt-get install -y curl \ | ||
&& curl -sSL "https://julialang-s3.julialang.org/bin/linux/x64/${JULIA_VERSION%[.-]*}/julia-${JULIA_VERSION}-linux-x86_64.tar.gz" -o julia.tar.gz \ | ||
&& curl -sSL "https://julialang-s3.julialang.org/bin/linux/x64/${JULIA_VERSION%[.-]*}/julia-${JULIA_VERSION}-linux-x86_64.tar.gz.asc" -o julia.tar.gz.asc \ | ||
&& export GNUPGHOME="$(mktemp -d)" \ | ||
# http://julialang.org/juliareleases.asc | ||
# https://julialang.org/juliareleases.asc | ||
# Julia (Binary signing key) <[email protected]> | ||
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 3673DF529D9049477F76B37566E3C7DC03D6E495 \ | ||
&& gpg --batch --verify julia.tar.gz.asc julia.tar.gz \ | ||
&& rm -r "$GNUPGHOME" julia.tar.gz.asc \ | ||
&& tar -xzf julia.tar.gz -C $JULIA_PATH --strip-components 1 \ | ||
&& rm -rf /var/lib/apt/lists/* julia.tar.gz* | ||
ENV JULIA_GPG 3673DF529D9049477F76B37566E3C7DC03D6E495 | ||
|
||
# https://julialang.org/downloads/ | ||
ENV JULIA_VERSION 0.6.0 | ||
|
||
RUN set -ex; \ | ||
\ | ||
# https://julialang.org/downloads/#julia-command-line-version | ||
# https://julialang-s3.julialang.org/bin/checksums/julia-0.6.0.sha256 | ||
# this "case" statement is generated via "update.sh" | ||
dpkgArch="$(dpkg --print-architecture)"; \ | ||
case "${dpkgArch##*-}" in \ | ||
amd64) tarArch='x86_64'; dirArch='x64'; sha256='3a27ea78b06f46701dc4274820d9853789db205bce56afdc7147f7bd6fa83e41' ;; \ | ||
armhf) tarArch='arm'; dirArch='arm'; sha256='7515f5977b2aac0cea1333ef249b3983928dee76ea8eb3de9dd6a7cdfbd07d2d' ;; \ | ||
i386) tarArch='i686'; dirArch='x86'; sha256='bfebd2ef38c25ce72dd6661cdd8a6f509800492a4d250c2908f83e791c0a444a' ;; \ | ||
*) echo >&2 "error: current architecture ($dpkgArch) does not have a corresponding Julia binary release"; exit 1 ;; \ | ||
esac; \ | ||
\ | ||
curl -fL -o julia.tar.gz "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${JULIA_VERSION%[.-]*}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz"; \ | ||
curl -fL -o julia.tar.gz.asc "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${JULIA_VERSION%[.-]*}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz.asc"; \ | ||
\ | ||
echo "${sha256} *julia.tar.gz" | sha256sum -c -; \ | ||
\ | ||
export GNUPGHOME="$(mktemp -d)"; \ | ||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$JULIA_GPG"; \ | ||
gpg --batch --verify julia.tar.gz.asc julia.tar.gz; \ | ||
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 | ||
|
||
|
||
ENV PATH $JULIA_PATH/bin:$PATH | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
FROM debian:jessie | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
ca-certificates \ | ||
curl \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
ENV JULIA_PATH /usr/local/julia | ||
|
||
# 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 -ex; \ | ||
\ | ||
# 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%%; \ | ||
\ | ||
curl -fL -o julia.tar.gz "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${JULIA_VERSION%[.-]*}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz"; \ | ||
curl -fL -o julia.tar.gz.asc "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${JULIA_VERSION%[.-]*}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz.asc"; \ | ||
\ | ||
echo "${sha256} *julia.tar.gz" | sha256sum -c -; \ | ||
\ | ||
export GNUPGHOME="$(mktemp -d)"; \ | ||
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$JULIA_GPG"; \ | ||
gpg --batch --verify julia.tar.gz.asc julia.tar.gz; \ | ||
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 | ||
|
||
|
||
ENV PATH $JULIA_PATH/bin:$PATH | ||
|
||
CMD ["julia"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# 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 arm arm | ||
i386 i386 i686 x86 | ||
|
||
# ppc64le appears to be "0.6.0-rc3"-only as of 2017-08-24 | ||
#ppc64le ppc64el ppc64le ppc64le | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,44 @@ | ||
#!/bin/bash | ||
set -e | ||
#!/usr/bin/env bash | ||
set -Eeuo pipefail | ||
|
||
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" | ||
pattern='.*\/julia-([0-9]+\.[0-9]+\.[0-9]+)-linux-x86_64\.tar\.gz.*' | ||
version=$(curl -sSL 'http://julialang.org/downloads/' | sed -rn "s/${pattern}/\1/gp") | ||
|
||
sed -ri 's/^(ENV JULIA_VERSION) .*/\1 '"$version"'/' "Dockerfile" | ||
source '.architectures-lib' | ||
|
||
# see http://stackoverflow.com/a/2705678/433558 | ||
sed_escape_rhs() { | ||
echo "$@" | sed -e 's/[\/&]/\\&/g' | sed -e ':a;N;$!ba;s/\n/\\n/g' | ||
} | ||
|
||
for version in '.'; do | ||
pattern='.*/julia-([0-9]+\.[0-9]+\.[0-9]+)-linux-x86_64\.tar\.gz.*' | ||
fullVersion="$(curl -fsSL 'https://julialang.org/downloads/' | sed -rn "s!${pattern}!\1!gp")" | ||
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="$(echo "$sha256s" | grep "*julia-${fullVersion}-linux-${tarArch}.tar.gz$" | cut -d' ' -f1)" | ||
if [ -z "$sha256" ]; then | ||
echo >&2 "error: cannot find sha256 for $fullVersion on arch $tarArch / $dirArch ($dpkgArch)" | ||
exit 1 | ||
fi | ||
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' | ||
|
||
echo "$version: $fullVersion" | ||
|
||
sed -r \ | ||
-e 's!%%JULIA_VERSION%%!'"$fullVersion"'!g' \ | ||
-e 's!%%ARCH-CASE%%!'"$(sed_escape_rhs "$linuxArchCase")"'!g' \ | ||
Dockerfile.template > "$version/Dockerfile" | ||
done |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like
aarch64
is also in-progress! 😄 👍