From 4bdfa63a461eb6d1f2e45a166bcb5b7db934c3ef Mon Sep 17 00:00:00 2001 From: Quantum Date: Tue, 21 Sep 2021 05:21:57 -0400 Subject: [PATCH] Make tier3 work with arm64 --- .github/workflows/docker.yml | 6 ++++++ tier3/Dockerfile | 24 +++++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index e9beb009..690514e3 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -67,12 +67,17 @@ jobs: run: make TAG=aarch64-latest image-tier2 - name: Test tier 2 Docker image run: make TAG=aarch64-latest test-tier2 + - name: Build tier 3 Docker image + run: make TAG=aarch64-latest image-tier3 + - name: Test tier 3 Docker image + run: make TAG=aarch64-latest test-tier3 - name: Push images to Docker if: (github.event_name == 'push' || github.event_name == 'schedule') && github.ref == 'refs/heads/master' run: | echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin docker push dmoj/runtimes-tier1:aarch64-latest docker push dmoj/runtimes-tier2:aarch64-latest + docker push dmoj/runtimes-tier3:aarch64-latest env: DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} @@ -82,6 +87,7 @@ jobs: echo "$CR_PAT" | docker login ghcr.io -u "$CR_USER" --password-stdin docker push ghcr.io/dmoj/runtimes-tier1:aarch64-latest docker push ghcr.io/dmoj/runtimes-tier2:aarch64-latest + docker push ghcr.io/dmoj/runtimes-tier3:aarch64-latest env: CR_USER: ${{ secrets.CR_USER }} CR_PAT: ${{ secrets.CR_PAT }} diff --git a/tier3/Dockerfile b/tier3/Dockerfile index 9a514225..ddeda597 100644 --- a/tier3/Dockerfile +++ b/tier3/Dockerfile @@ -1,14 +1,19 @@ FROM dmoj/runtimes-tier2 -RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \ - echo 'deb [arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main' > /etc/apt/sources.list.d/dart.list && \ +RUN (cd /opt && \ + case "$(arch)" in x86_64) DART_ARCH=x64;; aarch64) DART_ARCH=arm64;; *) false;; esac && \ + curl -L -odart.zip "https://storage.googleapis.com/dart-archive/channels/stable/release/$( \ + curl -sSL https://storage.googleapis.com/dart-archive/channels/stable/release/latest/VERSION | jq -r .version \ + )/sdk/dartsdk-linux-$DART_ARCH-release.zip" && \ + unzip dart.zip && find /opt/dart-sdk -type d -exec chmod go+rx {} + && rm dart.zip) && \ apt-get update && \ apt-get install -y --no-install-recommends unzip libtinfo5 xz-utils \ - coffeescript gnucobol4 gnat gfortran tcl lua5.3 intercal php-cli dart/stable gforth swi-prolog pike8.0 sbcl && \ + coffeescript gnucobol4 gnat gfortran tcl lua5.3 intercal php-cli gforth swi-prolog pike8.0 sbcl && \ rm -rf /var/lib/apt/lists/* && \ mkdir /opt/swift && \ - curl "$(echo -n https://swift.org; curl -s https://swift.org/download/ | grep 'Ubuntu 18.04' | grep 5.4 | head -n 1 | cut -d'"' -f 2)" | \ - tar xz -C /opt/swift --strip-components=1 && \ + if [ "$(arch)" = x86_64 ]; then \ + curl "https://swift.org$(curl -s https://swift.org/download/ | grep 'Ubuntu 18.04' | grep 5.4 | head -n 1 | cut -d'"' -f 2)" | \ + tar xz -C /opt/swift --strip-components=1; fi && \ curl -L -ogroovy.zip "$(curl -s https://groovy.apache.org/download.html | perl -ne 'if(/(['"'"'"])(https:[^'"'"'"]+-binary-[\d.]+\.zip)\1/){print$2;exit}')" && \ unzip groovy.zip && \ mkdir /opt/groovy && \ @@ -17,9 +22,10 @@ RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - & curl -L -okotlin.zip "$(curl -s https://api.github.com/repos/JetBrains/kotlin/releases | \ jq -r '[.[] | select(.prerelease | not) | .assets | flatten | .[] | select(.name | startswith("kotlin-compiler")) | .browser_download_url][0]')" && \ unzip kotlin.zip && mv kotlinc /opt/kotlin && rm kotlin.zip && \ - curl -L -otprolog.zip "https://github.com/yingted/OpenTuring/releases/download/v1.0.0-beta/tprolog-v1.0.0-beta.zip" && \ - unzip tprolog.zip && mv tprolog /opt && rm tprolog.zip && \ + if [ "$(arch)" = x86_64 ]; then \ + curl -L -otprolog.zip "https://github.com/yingted/OpenTuring/releases/download/v1.0.0-beta/tprolog-v1.0.0-beta.zip" && \ + unzip tprolog.zip && mv tprolog /opt && rm tprolog.zip; fi && \ mkdir /opt/zig && \ - curl "https://ziglang.org/download/0.6.0/zig-linux-x86_64-0.6.0.tar.xz" | tar xJ -C /opt/zig --strip-components=1 + curl "https://ziglang.org/download/0.6.0/zig-linux-$(arch)-0.6.0.tar.xz" | tar xJ -C /opt/zig --strip-components=1 -ENV PATH "/opt/tprolog:/opt/groovy/bin:/opt/kotlin/bin:${PATH}:/opt/swift/usr/bin:/opt/zig" +ENV PATH "/opt/tprolog:/opt/groovy/bin:/opt/kotlin/bin:/opt/dart-sdk/bin:${PATH}:/opt/swift/usr/bin:/opt/zig"