Skip to content

Commit

Permalink
ref(node-installer): rm installation of runtimes
Browse files Browse the repository at this point in the history
Signed-off-by: Vaughn Dice <[email protected]>
  • Loading branch information
vdice committed Mar 7, 2024
1 parent 163101b commit ca85084
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 31 deletions.
24 changes: 3 additions & 21 deletions node-installer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
# Based on: https://github.com/KWasm/kwasm-node-installer/blob/main/images/installer/Dockerfile

FROM scratch AS bin
ARG TARGETPLATFORM
COPY ./.tmp/${TARGETPLATFORM} /

FROM ubuntu:22.04 AS download-containerd-runwasi
RUN DEBIAN_FRONTEND=noninteractive apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y curl

RUN mkdir -p /release/bin/ \
&& curl -L https://github.com/containerd/runwasi/releases/download/containerd-shim-wasmedge%2Fv0.3.0/containerd-shim-wasmedge-$(uname -m | sed s/arm64/aarch64/g | sed s/amd64/x86_64/g).tar.gz | tar -xzf - -C /release/bin/ \
&& curl -L https://github.com/containerd/runwasi/releases/download/containerd-shim-wasmtime%2Fv0.3.0/containerd-shim-wasmtime-$(uname -m | sed s/arm64/aarch64/g | sed s/amd64/x86_64/g).tar.gz | tar -xzf - -C /release/bin/ \
&& curl -L https://github.com/containerd/runwasi/releases/download/containerd-shim-wasmer%2Fv0.3.0/containerd-shim-wasmer-$(uname -m | sed s/arm64/aarch64/g | sed s/amd64/x86_64/g).tar.gz | tar -xzf - -C /release/bin/

FROM busybox

ARG TARGETPLATFORM
COPY script/installer.sh /script/installer.sh
COPY --link --from=bin / /assets
COPY --link --from=download-containerd-runwasi /release/bin/containerd-shim-wasmedge-v1 /assets/
COPY --link --from=download-containerd-runwasi /release/bin/containerd-shim-wasmer-v1 /assets/
COPY --link --from=download-containerd-runwasi /release/bin/containerd-shim-wasmtime-v1 /assets/
CMD sh /script/installer.sh wasmedge
COPY ./.tmp/${TARGETPLATFORM} /assets
CMD sh /script/installer.sh
14 changes: 4 additions & 10 deletions node-installer/script/installer.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env sh
set -euo pipefail

# Based on: https://github.com/KWasm/kwasm-node-installer/blob/main/script/installer.sh
# Based on https://github.com/KWasm/kwasm-node-installer/blob/main/script/installer.sh
# Distilled to only configuring the Spin shim

KWASM_DIR=/opt/kwasm

Expand Down Expand Up @@ -30,19 +31,12 @@ fi

mkdir -p $NODE_ROOT$KWASM_DIR/bin/

cp /assets/containerd-shim-* $NODE_ROOT$KWASM_DIR/bin/
cp /assets/containerd-shim-spin-v2 $NODE_ROOT$KWASM_DIR/bin/

# TODO check if runtime config is already present
if ! grep -q wasmtime $NODE_ROOT$CONTAINERD_CONF; then
if ! grep -q spin $NODE_ROOT$CONTAINERD_CONF; then
echo '
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.spin]
runtime_type = "'$KWASM_DIR'/bin/containerd-shim-spin-v2"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.wasmedge]
runtime_type = "'$KWASM_DIR'/bin/containerd-shim-wasmedge-v1"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.wasmer]
runtime_type = "'$KWASM_DIR'/bin/containerd-shim-wasmer-v1"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.wasmtime]
runtime_type = "'$KWASM_DIR'/bin/containerd-shim-wasmtime-v1"
' >> $NODE_ROOT$CONTAINERD_CONF
rm -Rf $NODE_ROOT$KWASM_DIR/active
fi
Expand Down

0 comments on commit ca85084

Please sign in to comment.