diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5c96ab2e..9fd84c38 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -147,11 +147,20 @@ jobs: uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository }} + - name: Short commit SHA + id: short + run: | + SHA="${{github.event.pull_request.head.sha}}${{ github.sha }}" + SHORT_SHA=${SHA:0:7} + echo "sha: $SHORT_SHA" + echo "sha=$SHORT_SHA" >> $GITHUB_OUTPUT - name: Build and publish Docker image uses: docker/build-push-action@v5 with: context: . push: true + build-args: | + WEBRCI_SHA=${{ steps.short.outputs.sha }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-nix: diff --git a/Dockerfile b/Dockerfile index 48c882e9..a33c290e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ ARG BASE=ghcr.io/r-wasm/flang-wasm:main +ARG WEBRCI_SHA=HEAD FROM $BASE as webr # Setup environment for Emscripten @@ -15,13 +16,13 @@ ENV EMFC="/opt/flang/host/bin/flang-new" FROM webr as deb_build RUN mkdir /opt/fake_rust/ && \ apt-get update && \ - apt-get install -y equivs lsb-release &&\ - equivs-control fake_rust && \ - sed -i 's/Package:.*/Package: rustc/' fake_rust && \ - sed -i 's/# Version:.*/Version: 99.0/' fake_rust && \ - equivs-build fake_rust && \ - sed -i 's/Package:.*/Package: cargo/' fake_rust && \ - equivs-build fake_rust && \ + apt-get install -y equivs lsb-release &&\ + equivs-control fake_rust && \ + sed -i 's/Package:.*/Package: rustc/' fake_rust && \ + sed -i 's/# Version:.*/Version: 99.0/' fake_rust && \ + equivs-build fake_rust && \ + sed -i 's/Package:.*/Package: cargo/' fake_rust && \ + equivs-build fake_rust && \ mv rustc_99.0_all.deb cargo_99.0_all.deb /opt/fake_rust/ # Step 2: Do the necessary setups @@ -31,7 +32,7 @@ RUN mkdir -p /etc/apt/keyrings && \ curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | \ gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \ echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] \ - https://deb.nodesource.com/node_18.x nodistro main" | \ + https://deb.nodesource.com/node_18.x nodistro main" | \ tee /etc/apt/sources.list.d/nodesource.list && \ apt-get update && \ apt-get install nodejs -y @@ -46,12 +47,12 @@ RUN set -eux; \ echo "0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db *rustup-init" | sha256sum -c -; \ chmod +x rustup-init; \ ./rustup-init -y \ - --no-modify-path \ - --profile minimal \ - --default-toolchain nightly \ - --default-host x86_64-unknown-linux-gnu \ - --target wasm32-unknown-emscripten \ - --component rust-src; \ + --no-modify-path \ + --profile minimal \ + --default-toolchain nightly \ + --default-host x86_64-unknown-linux-gnu \ + --target wasm32-unknown-emscripten \ + --component rust-src; \ rm rustup-init; \ chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \ rustup --version; \ @@ -75,7 +76,8 @@ ENV R_LIBS_USER=/opt/R/current/lib/R/site-library RUN rig add 4.3.2 # Download webR and configure for LLVM flang -RUN git clone --depth=1 https://github.com/r-wasm/webr.git /opt/webr +RUN git clone https://github.com/r-wasm/webr.git /opt/webr +RUN git checkout ${WEBRCI_SHA} WORKDIR /opt/webr RUN ./configure