From 687967d8c28e67a5c7cbe98db274da2fd7770509 Mon Sep 17 00:00:00 2001 From: Anuraag Agrawal Date: Wed, 8 Feb 2023 11:44:47 +0900 Subject: [PATCH] Use upstream wasi-sdk docker image (#146) --- .github/workflows/buildtools-wasi-sdk.yaml | 48 ---------------------- buildtools/tinygo/Dockerfile | 3 +- buildtools/tinygo/wasi-libc.Dockerfile | 4 +- buildtools/wasi-sdk/Dockerfile | 29 ------------- 4 files changed, 4 insertions(+), 80 deletions(-) delete mode 100644 .github/workflows/buildtools-wasi-sdk.yaml delete mode 100644 buildtools/wasi-sdk/Dockerfile diff --git a/.github/workflows/buildtools-wasi-sdk.yaml b/.github/workflows/buildtools-wasi-sdk.yaml deleted file mode 100644 index 470b0e2db1635..0000000000000 --- a/.github/workflows/buildtools-wasi-sdk.yaml +++ /dev/null @@ -1,48 +0,0 @@ -name: Build wasi-sdk -on: - push: - branches: - - main - paths: - - buildtools/wasi-sdk/** - - .github/workflows/buildtools-wasi-sdk.yaml - pull_request: - branches: - - main - paths: - - buildtools/wasi-sdk/** - - .github/workflows/buildtools-wasi-sdk.yaml - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-22.04 - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v3 - - - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - uses: docker/setup-qemu-action@v2 - - uses: docker/setup-buildx-action@v2 - - - uses: docker/metadata-action@v4 - id: meta - with: - images: ghcr.io/${{ github.repository }}/buildtools-wasi-sdk - - - uses: docker/build-push-action@v3 - with: - context: buildtools/wasi-sdk - push: ${{ github.event_name != 'pull_request' }} - platforms: linux/amd64,linux/arm64 - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max diff --git a/buildtools/tinygo/Dockerfile b/buildtools/tinygo/Dockerfile index 8c64faaa34094..e730bd020c2c2 100644 --- a/buildtools/tinygo/Dockerfile +++ b/buildtools/tinygo/Dockerfile @@ -4,10 +4,11 @@ ARG WASI_LIBC_IMAGE FROM --platform=linux/amd64 ${WASI_LIBC_IMAGE:-ghcr.io/corazawaf/coraza-proxy-wasm/buildtools-tinygo-wasi-libc:main} AS wasi-libc -FROM ghcr.io/corazawaf/coraza-proxy-wasm/buildtools-wasi-sdk:main +FROM ghcr.io/webassembly/wasi-sdk:wasi-sdk-19 ARG TARGETARCH +RUN apt-get update && apt-get install -y curl RUN curl -L https://go.dev/dl/go1.19.2.linux-${TARGETARCH:-amd64}.tar.gz | tar -xz ENV PATH /go/bin:/root/go/bin:$PATH diff --git a/buildtools/tinygo/wasi-libc.Dockerfile b/buildtools/tinygo/wasi-libc.Dockerfile index 7fad0aab6f233..73741946628ea 100644 --- a/buildtools/tinygo/wasi-libc.Dockerfile +++ b/buildtools/tinygo/wasi-libc.Dockerfile @@ -1,9 +1,9 @@ # Copyright 2022 The OWASP Coraza contributors # SPDX-License-Identifier: Apache-2.0 -FROM ghcr.io/corazawaf/coraza-proxy-wasm/buildtools-wasi-sdk:main +FROM ghcr.io/webassembly/wasi-sdk:wasi-sdk-19 -RUN apt-get install -y git +RUN apt-get update && apt-get install -y git RUN git clone https://github.com/tinygo-org/tinygo --branch dev WORKDIR /tinygo diff --git a/buildtools/wasi-sdk/Dockerfile b/buildtools/wasi-sdk/Dockerfile deleted file mode 100644 index 085103d09779c..0000000000000 --- a/buildtools/wasi-sdk/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2022 The OWASP Coraza contributors -# SPDX-License-Identifier: Apache-2.0 - -FROM ubuntu:22.04 - -RUN apt-get update && apt-get install -y curl gnupg make - -RUN curl -sS https://apt.llvm.org/llvm-snapshot.gpg.key | gpg --dearmor > /etc/apt/trusted.gpg.d/llvm.gpg && \ - echo "deb [signed-by=/etc/apt/trusted.gpg.d/llvm.gpg] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" >> /etc/apt/sources.list.d/llvm.list && \ - echo "deb-src [signed-by=/etc/apt/trusted.gpg.d/llvm.gpg] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" >> /etc/apt/sources.list.d/llvm.list - -RUN apt-get update && apt-get install -y clang-15 lld-15 - -ADD https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-17/wasi-sysroot-17.0.tar.gz / -RUN tar -xf wasi-sysroot-17.0.tar.gz - -ADD https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-17/libclang_rt.builtins-wasm32-wasi-17.0.tar.gz / -# APT repository and package only include major version but the directory includes a patch version. -# We use a wildcard to make this compatible for any patch version. -RUN tar -xf libclang_rt.builtins-wasm32-wasi-17.0.tar.gz -C /usr/lib/llvm-15/lib/clang/15.*/ - -ENV CC clang-15 -ENV CXX clang++-15 -ENV LD wasm-ld-15 -ENV AR llvm-ar-15 -ENV RANLIB llvm-ranlib-15 -ENV CFLAGS -O3 --target=wasm32-wasi --sysroot=/wasi-sysroot -ENV CXXFLAGS -O3 -fno-exceptions --target=wasm32-wasi --sysroot=/wasi-sysroot -ENV LDFLAGS ${CXXFLAGS} --rtlib=compiler-rt -Wl,--demangle,--allow-undefined