Skip to content

Commit

Permalink
Add ARM64 support
Browse files Browse the repository at this point in the history
Signed-off-by: odidev <odidev@puresoftware.com>
  • Loading branch information
odidev committed Oct 18, 2021
1 parent 25d12b3 commit 54b8e46
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 24 deletions.
48 changes: 44 additions & 4 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ defaults:
shell: "bash -Eeuo pipefail -x {0}"

jobs:
generate-jobs:
name: Generate Jobs
generate-jobs-amd64:
name: Generate Jobs AMD64
runs-on: ubuntu-latest
outputs:
strategy: ${{ steps.generate-jobs.outputs.strategy }}
Expand All @@ -40,8 +40,8 @@ jobs:
strategy="$(bashbrew/scripts/github-actions/generate.sh)"
jq . <<<"$strategy" # sanity check / debugging aid
echo "::set-output name=strategy::$strategy"
test:
needs: generate-jobs
test-amd64:
needs: generate-jobs-amd64
strategy: ${{ fromJson(needs.generate-jobs.outputs.strategy) }}
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
Expand All @@ -59,3 +59,43 @@ jobs:
run: ${{ matrix.runs.test }}
- name: '"docker images"'
run: ${{ matrix.runs.images }}
generate-jobs-arm64:
name: Generate Jobs ARM64
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
- name: Set up emulation
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
path: bashbrew
ref: v0.1.2
repository: docker-library/bashbrew
- uses: actions/checkout@v2
with:
path: dart-lang
repository: dart-lang/setup-dart
- name: Building and Testing dart on ARM64
uses: docker://multiarch/ubuntu-core:arm64-focal
with:
args: |
bash -c "apt-get update && \
apt-get install -y git curl unzip apt-transport-https ca-certificates gnupg lsb-release && \
DEBIAN_FRONTEND="noninteractive" TZ="Asia/Kolkata" apt-get install -y tzdata && \
apt-get install -y golang && \
$GITHUB_WORKSPACE/dart-lang/setup.sh stable Linux arm64 && \
cp $GITHUB_WORKSPACE/scripts/pubspec.yaml $GITHUB_WORKSPACE/ && \
export PATH=$PATH:$RUNNER_TOOL_CACHE/dart-sdk/bin/ && \
export PATH=$PATH:$GITHUB_WORKSPACE/scripts/ && \
export PATH=$PATH:$GITHUB_WORKSPACE/scripts/lib/src/ && \
dart pub get && \
git clone --depth 1 https://github.com/docker-library/official-images.git -b master ~/oi && \
curl -fsSL test.docker.com -o get-docker.sh && sh get-docker.sh && \
uname -m && \
docker build --platform linux/arm64 --tag 'dart:2.14.3-sdk' --tag 'dart:2.14-sdk' --tag 'dart:2-sdk' --tag 'dart:stable-sdk' --tag 'dart:sdk' --tag 'dart:2.14.3' --tag 'dart:2.14' --tag 'dart:2' --tag 'dart:stable' --tag 'dart:latest' -f stable/buster/Dockerfile . && \
~/oi/test/run.sh 'dart:2.14.3-sdk' && \
docker build --platform linux/arm64 --tag 'dart:2.15.0-82.2.beta-sdk' --tag 'dart:beta-sdk' --tag 'dart:2.15.0-82.2.beta' --tag 'dart:beta' -f beta/buster/Dockerfile . && \
~/oi/test/run.sh 'dart:2.15.0-82.2.beta-sdk'"
29 changes: 19 additions & 10 deletions beta/buster/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,26 @@ RUN set -eux; \
# usage: COPY --from=dart:xxx /runtime/ /
# uses hard links here to save space
RUN set -eux; \
case "$(dpkg --print-architecture)" in \
arm64) ARCH="aarch64-linux-gnu" ; \
mkdir -p /runtime/lib/"$ARCH" ; \
cp /lib/ld-linux-aarch64.so.1 /runtime/lib/ld-linux-aarch64.so.1 ; \
cp /lib/aarch64-linux-gnu/ld-linux-aarch64.so.1 \
/runtime/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1 ;; \
amd64) ARCH="x86_64-linux-gnu" ; \
mkdir -p /runtime/lib64/ ; \
cp /lib64/ld-linux-x86-64.so.2 /runtime/lib64/ld-linux-x86-64.so.2 ;; \
esac && \
for f in \
/etc/nsswitch.conf \
/etc/ssl/certs \
/lib/x86_64-linux-gnu/libc.so.6 \
/lib/x86_64-linux-gnu/libdl.so.2 \
/lib/x86_64-linux-gnu/libm.so.6 \
/lib/x86_64-linux-gnu/libnss_dns.so.2 \
/lib/x86_64-linux-gnu/libpthread.so.0 \
/lib/x86_64-linux-gnu/libresolv.so.2 \
/lib/x86_64-linux-gnu/librt.so.1 \
/lib64/ld-linux-x86-64.so.2 \
/lib/"$ARCH"/libc.so.6 \
/lib/"$ARCH"/libdl.so.2 \
/lib/"$ARCH"/libm.so.6 \
/lib/"$ARCH"/libnss_dns.so.2 \
/lib/"$ARCH"/libpthread.so.0 \
/lib/"$ARCH"/libresolv.so.2 \
/lib/"$ARCH"/librt.so.1 \
/usr/share/ca-certificates \
; do \
dir="$(dirname "$f")"; \
Expand All @@ -40,12 +49,12 @@ ENV PATH $DART_SDK/bin:$PATH

WORKDIR /root
RUN set -eux; \
ARCH=$(case "$(dpkg --print-architecture)" in amd64) echo "x64";; esac;); \
ARCH=$(case "$(dpkg --print-architecture)" in amd64) echo "x64";; arm64) echo "arm64";; esac;); \
SDK="dartsdk-linux-$ARCH-release.zip"; \
BASEURL="https://storage.googleapis.com/dart-archive/channels"; \
URL="$BASEURL/beta/release/2.15.0-82.2.beta/sdk/$SDK"; \
echo "SDK: $URL" >> dart_setup.log ; \
curl -fLO "$URL"; \
echo "3f23b4ca6d7ffeadad21cd69577eabcfb5d872cbd005f04b5d4f58c1866dcf04 *$SDK" \
if [ $ARCH = "x64" ]; then echo "3f23b4ca6d7ffeadad21cd69577eabcfb5d872cbd005f04b5d4f58c1866dcf04 *$SDK"; elif [ $ARCH = "arm64" ]; then echo "00ad354ef816d39bfe046a40c567775f1b758aa19489e153c3c4b840b1b19d57 *$SDK"; fi \
| sha256sum --check --status --strict -; \
unzip "$SDK" && mv dart-sdk "$DART_SDK" && rm "$SDK";
29 changes: 19 additions & 10 deletions stable/buster/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,26 @@ RUN set -eux; \
# usage: COPY --from=dart:xxx /runtime/ /
# uses hard links here to save space
RUN set -eux; \
case "$(uname -m)" in \
aarch64) ARCH="aarch64-linux-gnu" ; \
mkdir -p /runtime/lib/"$ARCH" ; \
cp /lib/ld-linux-aarch64.so.1 /runtime/lib/ld-linux-aarch64.so.1 ; \
cp /lib/aarch64-linux-gnu/ld-linux-aarch64.so.1 \
/runtime/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1 ;; \
x64) ARCH="x86_64-linux-gnu" ; \
mkdir -p /runtime/lib64/ ; \
cp /lib64/ld-linux-x86-64.so.2 /runtime/lib64/ld-linux-x86-64.so.2 ;; \
esac && \
for f in \
/etc/nsswitch.conf \
/etc/ssl/certs \
/lib/x86_64-linux-gnu/libc.so.6 \
/lib/x86_64-linux-gnu/libdl.so.2 \
/lib/x86_64-linux-gnu/libm.so.6 \
/lib/x86_64-linux-gnu/libnss_dns.so.2 \
/lib/x86_64-linux-gnu/libpthread.so.0 \
/lib/x86_64-linux-gnu/libresolv.so.2 \
/lib/x86_64-linux-gnu/librt.so.1 \
/lib64/ld-linux-x86-64.so.2 \
/lib/"$ARCH"/libc.so.6 \
/lib/"$ARCH"/libdl.so.2 \
/lib/"$ARCH"/libm.so.6 \
/lib/"$ARCH"/libnss_dns.so.2 \
/lib/"$ARCH"/libpthread.so.0 \
/lib/"$ARCH"/libresolv.so.2 \
/lib/"$ARCH"/librt.so.1 \
/usr/share/ca-certificates \
; do \
dir="$(dirname "$f")"; \
Expand All @@ -40,12 +49,12 @@ ENV PATH $DART_SDK/bin:$PATH

WORKDIR /root
RUN set -eux; \
ARCH=$(case "$(dpkg --print-architecture)" in amd64) echo "x64";; esac;); \
ARCH=$(case "$(dpkg --print-architecture)" in amd64) echo "x64";; arm64) echo "arm64";; esac;); \
SDK="dartsdk-linux-$ARCH-release.zip"; \
BASEURL="https://storage.googleapis.com/dart-archive/channels"; \
URL="$BASEURL/stable/release/2.14.3/sdk/$SDK"; \
echo "SDK: $URL" >> dart_setup.log ; \
curl -fLO "$URL"; \
echo "cad36ec238af96c8048bbcec4cff7e69fcb1b895620010ca1762674ca4ade171 *$SDK" \
if [ $ARCH = "x64" ]; then echo "cad36ec238af96c8048bbcec4cff7e69fcb1b895620010ca1762674ca4ade171 *$SDK"; elif [ $ARCH = "arm64" ]; then echo "a6ede5f0d93ab53b619871c31c274d1fb63c23be1661690bf25402359cb5fac8 *$SDK"; fi \
| sha256sum --check --status --strict -; \
unzip "$SDK" && mv dart-sdk "$DART_SDK" && rm "$SDK";

0 comments on commit 54b8e46

Please sign in to comment.