Skip to content

Commit

Permalink
Add protoc-gen-js to protoc-web image
Browse files Browse the repository at this point in the history
  • Loading branch information
amothic committed Nov 1, 2023
1 parent dc0cd37 commit c902eef
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions web/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
FROM alpine:3.18

ENV GRPC_WEB_VERSION 1.4.2
ENV PROTOC_JS_VERSION 3.21.2
ENV PROTOC_GRPC_WEB_VERSION 1.4.2
ARG TARGETPLATFORM

RUN apk add --no-cache protoc protobuf-dev
RUN apk add --no-cache protoc protobuf-dev gcompat

# Install protoc-gen-js
RUN set -ex; \
PLATFORM=$( \
case "${TARGETPLATFORM}" in \
"linux/amd64") echo "x86_64";; \
"linux/arm64") echo "aarch_64";; \
*) echo "x86_64";; \
esac \
); \
apk add --no-cache --virtual .fetch-deps curl tar; \
curl -fsL "https://github.com/protocolbuffers/protobuf-javascript/releases/download/v${PROTOC_JS_VERSION}/protobuf-javascript-${PROTOC_JS_VERSION}-linux-${PLATFORM}.tar.gz" -o protobuf-javascript.tar.gz; \
tar zxf protobuf-javascript.tar.gz --strip-components=1 bin/protoc-gen-js; \
rm protobuf-javascript.tar.gz; \
chmod +x protoc-gen-js; \
mv protoc-gen-js /usr/local/bin/; \
apk del .fetch-deps

# Install protoc-gen-grpc-web
RUN set -ex; \
PLATFORM=$( \
case "${TARGETPLATFORM}" in \
Expand All @@ -13,8 +33,9 @@ RUN set -ex; \
esac \
); \
apk add --no-cache --virtual .fetch-deps curl; \
curl -fsL "https://github.com/grpc/grpc-web/releases/download/${GRPC_WEB_VERSION}/protoc-gen-grpc-web-${GRPC_WEB_VERSION}-linux-${PLATFORM}" -o protoc-gen-grpc-web; \
curl -fsL "https://github.com/grpc/grpc-web/releases/download/${PROTOC_GRPC_WEB_VERSION}/protoc-gen-grpc-web-${PROTOC_GRPC_WEB_VERSION}-linux-${PLATFORM}" -o protoc-gen-grpc-web; \
chmod +x protoc-gen-grpc-web; \
mv protoc-gen-grpc-web /usr/local/bin/; \
apk del .fetch-deps

ENTRYPOINT ["/usr/bin/protoc"]

0 comments on commit c902eef

Please sign in to comment.