diff --git a/Dockerfile b/Dockerfile index 45d9ee2..9c5a112 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,16 @@ RUN git clone -b ${CGRPC_VERSION} --recursive https://github.com/grpc/grpc RUN cd grpc && make plugins -j 12 +FROM vato.ddns.net:8083/swift AS SWIFT_BUILDER + +ARG GRPC_SWIFT_VERSION=1.0.0-alpha.21 + +RUN git clone -b ${GRPC_SWIFT_VERSION} https://github.com/grpc/grpc-swift.git grpc-swift + +COPY ./build_grpc_swift_plugins_static.sh grpc-swift/ + +RUN cd grpc-swift && chmod +x build_grpc_swift_plugins_static.sh && ./build_grpc_swift_plugins_static.sh && rm -rf .build + FROM vato.ddns.net:8083/alpine ARG ARCH=x86_64 @@ -31,8 +41,6 @@ RUN rm protoc-gen-grpc-web-*.sha256 && \ mv protoc-gen-grpc-web-* /usr/bin/protoc-gen-grpc-web && \ chmod +x /usr/bin/protoc-gen-grpc-web -COPY ./protoc-gen-* /usr/bin/ - COPY --from=CGRPC_BUILDER /grpc/bins/opt/grpc_python_plugin /usr/bin/protoc-gen-grpc-python -ENTRYPOINT ["protoc"] \ No newline at end of file +COPY --from=SWIFT_BUILDER /grpc-swift/protoc-gen-* /usr/bin/ diff --git a/README.md b/README.md index 1a694ef..cc71b25 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,5 @@ Not copying them across will save ~100mb in space. ## TODOS -- Build the swift plugins inside the dockerfile, rather than committing the built plugins - Build the grpc-web plugins in the dockerfile, rather than downloading built versions -- Use CMake/Bazel for building the grpc plugins - [CMake dockerfile](https://hub.docker.com/r/kitware/cmake) \ No newline at end of file +- Use CMake/Bazel for building the c grpc plugins - [CMake dockerfile](https://hub.docker.com/r/kitware/cmake) \ No newline at end of file diff --git a/build_grpc_swift_plugins_static.sh b/build_grpc_swift_plugins_static.sh new file mode 100644 index 0000000..16878e0 --- /dev/null +++ b/build_grpc_swift_plugins_static.sh @@ -0,0 +1,10 @@ +SWIFT_BUILD_PATH=./.build + +PROTOC_GEN_SWIFT=${SWIFT_BUILD_PATH}/release/protoc-gen-swift +PROTOC_GEN_GRPC_SWIFT=${SWIFT_BUILD_PATH}/release/protoc-gen-grpc-swift + +MAIN_SCRIPT="swift build --configuration=release --build-path=${SWIFT_BUILD_PATH} -Xswiftc -static-executable" +${MAIN_SCRIPT} --product protoc-gen-swift +${MAIN_SCRIPT} --product protoc-gen-grpc-swift +cp ${SWIFT_BUILD_PATH}/release/protoc-gen-swift . +cp ${SWIFT_BUILD_PATH}/release/protoc-gen-grpc-swift . \ No newline at end of file diff --git a/protoc-gen-grpc-swift-linux b/protoc-gen-grpc-swift-linux deleted file mode 100755 index 5419c39..0000000 Binary files a/protoc-gen-grpc-swift-linux and /dev/null differ diff --git a/protoc-gen-swift-linux b/protoc-gen-swift-linux deleted file mode 100755 index 9a23e21..0000000 Binary files a/protoc-gen-swift-linux and /dev/null differ