-
Notifications
You must be signed in to change notification settings - Fork 566
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
Implement Rust Wasm Plugin Build & Publish Action #1483
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need another Dockerfile to build? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I referred to the builder used for packaging and publishing in the go-lang https://github.com/alibaba/higress/blob/main/plugins/wasm-go/DockerfileBuilder There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dockerfile is enough, no need additional files There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both Dockerfile and DockerfileBuilder are for building an artifact named plugin.wasm, but the oras is a client which aims to publish artifact to registry. It means no matter which language is, the only different is how to build an artifact but using same way to publish artifact. In a word, I think the oras should be a independent image, but not mixed in builders. cc @johnlanni There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. builder mainly facilitates developers by eliminating the need to download corresponding versions of oras, as well as Rust build tools, etc There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For developers, devcontainer might be the best solution and I still think it should keep simple for OCI building There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, you're right, developers just need the Dockerfile, but it seems that the DockerfileBuilder used for building images allows the workflow for publishing wasm plugins to remain consistent with Go. From this perspective, it still makes sense |
||
ARG RUST_VERSION | ||
ARG ORAS_VERSION | ||
ARG HIGRESS_VERSION | ||
|
||
ARG BASE_IMAGE=rust:${RUST_VERSION:-1.82} | ||
FROM $BASE_IMAGE | ||
|
||
LABEL rust_version=$RUST_VERSION oras_version=$ORAS_VERSION | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y wget gcc gcc-multilib llvm clang \ | ||
&& rustup target add wasm32-wasi \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN arch="$(dpkg --print-architecture)"; arch="${arch##*-}"; \ | ||
rust_version=${RUST_VERSION:-1.82}; \ | ||
oras_version=${ORAS_VERSION:-1.0.0}; \ | ||
higress_version=${HIGRESS_VERSION:-1.0.0-rc}; \ | ||
echo "arch: '$arch'"; \ | ||
echo "rust rust_version: '$rust_version'"; \ | ||
echo "oras_version: '$oras_version'"; \ | ||
echo "higress_version: '$higress_version'"; \ | ||
case "$arch" in \ | ||
'amd64') \ | ||
oras_url="https://github.com/oras-project/oras/releases/download/v$oras_version/oras_${oras_version}_linux_amd64.tar.gz"; \ | ||
;; \ | ||
'arm64') \ | ||
oras_url="https://github.com/oras-project/oras/releases/download/v$oras_version/oras_${oras_version}_linux_arm64.tar.gz"; \ | ||
;; \ | ||
*) echo >&2 "error: unsupported architecture '$arch' "; exit 1 ;; \ | ||
esac; \ | ||
echo "oras_url: '$oras_url'"; \ | ||
wget -O oras.tgz "$oras_url" --progress=dot:giga; \ | ||
tar -C /usr/local/bin -xzf oras.tgz && rm -rf oras.tgz; \ | ||
echo "done"; | ||
|
||
ENV PATH=$PATH:/usr/local/bin |
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.
don't use full width character in english comments
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.
done