Skip to content

Commit 2f98b01

Browse files
committed
chore: cross compile grpc-web
1 parent e3f431d commit 2f98b01

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

Dockerfile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,24 +189,29 @@ RUN install -D ./options.proto /out/usr/include/github.com/chrusty/protoc-gen-js
189189
RUN xx-verify /out/usr/bin/protoc-gen-jsonschema
190190

191191

192-
FROM alpine:${ALPINE_IMAGE_VERSION} AS grpc_web
192+
FROM --platform=$BUILDPLATFORM alpine:${ALPINE_IMAGE_VERSION} AS grpc_web
193193
RUN apk add --no-cache \
194194
autoconf \
195195
automake \
196196
build-base \
197+
clang \
197198
git \
198-
libtool
199+
libtool \
200+
zlib-dev
199201
ARG GRPC_WEB_VERSION
200202
RUN git clone --recurse-submodules --branch=$GRPC_WEB_VERSION https://github.com/grpc/grpc-web.git
201203
WORKDIR /grpc-web/third_party/protobuf
204+
COPY --from=xx / /
205+
ARG TARGETPLATFORM
206+
RUN xx-apk add --no-cache g++
202207
RUN ./autogen.sh && \
203-
./configure && \
208+
./configure --host=$(xx-clang --print-target-triple) && \
204209
make -j$(nproc) && \
205210
make install
206211
WORKDIR /grpc-web
207-
RUN make -j$(nproc) install-plugin
208-
RUN install -Ds /usr/local/bin/protoc-gen-grpc-web /out/usr/bin/protoc-gen-grpc-web
209-
212+
RUN CXX=$(xx-info)-clang++ make -j$(nproc) install-plugin
213+
RUN install -D /usr/local/bin/protoc-gen-grpc-web /out/usr/bin/protoc-gen-grpc-web
214+
RUN xx-verify /out/usr/bin/protoc-gen-grpc-web
210215

211216
FROM --platform=$BUILDPLATFORM rust:${RUST_IMAGE_VERSION} AS rust_target
212217
COPY --from=xx / /

0 commit comments

Comments
 (0)