@@ -315,6 +315,42 @@ ARG TARGETPLATFORM
315
315
RUN xx-verify /out/usr/bin/protoc-gen-lint
316
316
317
317
318
+ FROM alpine:${ALPINE_IMAGE_VERSION} as protoc_gen_js
319
+ COPY --from=xx / /
320
+ RUN mkdir -p /out
321
+ RUN apk add --no-cache \
322
+ bash \
323
+ build-base \
324
+ curl \
325
+ linux-headers \
326
+ openjdk11-jdk \
327
+ python3 \
328
+ unzip \
329
+ zip
330
+
331
+ # Build Bazel
332
+ # TODO: Remove when Bazel 5.2.0+ is available in Alpine
333
+ # https://github.com/bazelbuild/bazel/pull/14391
334
+ ARG BAZEL_VERSION=6.0.0
335
+ RUN mkdir -p /tmp/bazel-release
336
+ WORKDIR /tmp/bazel-release
337
+ RUN curl -sSLO https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-dist.zip && unzip -q bazel-${BAZEL_VERSION}-dist.zip
338
+ RUN env EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk" bash ./compile.sh
339
+ RUN install -D output/bazel /usr/local/bin/bazel
340
+
341
+ # Build protoc-gen-js
342
+ # TODO: Remove when protoc-gen-js is available in Alpine
343
+ # https://gitlab.alpinelinux.org/alpine/aports/-/issues/14399
344
+ RUN mkdir -p /protoc_gen_js
345
+ ARG PROTOC_GEN_JS_VERSION
346
+ RUN curl -sSL https://api.github.com/repos/protocolbuffers/protobuf-javascript/tarball/${PROTOC_GEN_JS_VERSION} | tar xz --strip 1 -C /protoc_gen_js
347
+ WORKDIR /protoc_gen_js
348
+ RUN bazel build plugin_files
349
+ RUN install -D /protoc_gen_js/bazel-bin/generator/protoc-gen-js /out/usr/bin/protoc-gen-js
350
+ ARG TARGETPLATFORM
351
+ RUN xx-verify /out/usr/bin/protoc-gen-js
352
+
353
+
318
354
FROM node:${NODE_IMAGE_VERSION} as protoc_gen_ts
319
355
ARG NODE_IMAGE_VERSION
320
356
ARG PROTOC_GEN_TS_VERSION
@@ -368,6 +404,7 @@ COPY --from=protoc_gen_gorm /out/ /out/
368
404
COPY --from=protoc_gen_gotemplate /out/ /out/
369
405
COPY --from=protoc_gen_govalidators /out/ /out/
370
406
COPY --from=protoc_gen_gql /out/ /out/
407
+ COPY --from=protoc_gen_js /out/ /out/
371
408
COPY --from=protoc_gen_jsonschema /out/ /out/
372
409
COPY --from=protoc_gen_lint /out/ /out/
373
410
COPY --from=protoc_gen_rust /out/ /out/
0 commit comments