diff --git a/images/extension-builders/tinygo/Dockerfile b/images/extension-builders/tinygo/Dockerfile index 7d22bd26..e795e94b 100644 --- a/images/extension-builders/tinygo/Dockerfile +++ b/images/extension-builders/tinygo/Dockerfile @@ -18,21 +18,26 @@ FROM golang:1.15 -ENV TINYGO_VERSION=0.15.0 +RUN git clone --recursive -b non-js-wasm https://github.com/mathetake/tinygo tinygo +WORKDIR tinygo +RUN apt-get update && apt-get -y install cmake clang ninja-build +ENV CC=clang +ENV CXX=clang++ -RUN wget https://github.com/tinygo-org/tinygo/releases/download/v${TINYGO_VERSION}/tinygo_${TINYGO_VERSION}_amd64.deb -RUN dpkg -i tinygo_${TINYGO_VERSION}_amd64.deb && rm tinygo_${TINYGO_VERSION}_amd64.deb +RUN make llvm-source +RUN make llvm-build +RUN make wasi-libc +RUN make tinygo + +FROM golang:1.15 + +# TODO: use upstream TinyGo after https://github.com/tinygo-org/tinygo/pull/1373 is merged +COPY --from=0 /go/tinygo/build/tinygo /usr/local/bin ENV GOCACHE=/source/.gocache ENV GOMODCACHE=/source/.gomodcache ENV XDG_CACHE_HOME=/source/.cache -ENV TINYGO_SDK_NAME=github.com/tetratelabs/proxy-wasm-go-sdk -ENV TINYGO_SDK_VERSION=v0.0.2 -ENV TINYGO_SDK_PATH=${GOMODCACHE}/${TINYGO_SDK_NAME}@${TINYGO_SDK_VERSION} - -RUN mkdir -p ${TINYGO_SDK_PATH} && git clone https://${TINYGO_SDK_NAME} -b ${TINYGO_SDK_VERSION} ${TINYGO_SDK_PATH} - COPY ./entrypoint.sh /usr/local/getenvoy/extension/builder/entrypoint.sh COPY ./tinygo/commands.sh /usr/local/getenvoy/extension/builder/commands.sh ENTRYPOINT ["/usr/local/getenvoy/extension/builder/entrypoint.sh"]