5 Commits
0.0.1 ... 1.1.0

Author SHA1 Message Date
Michael Pivato
983a1460d8 Merge branch 'compile-swift' into 'main'
See merge request vato007/protoc-docker!1
2020-11-29 11:16:50 +00:00
Michael Pivato
d805586f15 Compile grpc-swift plugins in Dockerfile 2020-11-29 11:16:49 +00:00
Piv
24bc8259bd Use protoc as entrypoint 2020-11-24 12:45:48 +10:30
Piv
d0ce4a41a3 Update readme 2020-11-24 12:42:04 +10:30
Piv
423db22640 Add grpc python build 2020-11-23 21:54:39 +10:30
5 changed files with 37 additions and 2 deletions

View File

@@ -1,3 +1,23 @@
FROM vato.ddns.net:8083/debian:buster AS CGRPC_BUILDER
ARG CGRPC_VERSION=v1.33.2
RUN apt update -y && apt install git build-essential autoconf libtool pkg-config zlib1g-dev -y
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
@@ -21,4 +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
COPY --from=SWIFT_BUILDER /grpc-swift/protoc-gen-* /usr/bin/

View File

@@ -1,7 +1,10 @@
# Protoc Docker
Docker container for generating protobuf code. Right now used in CI only for other projects.
Smallish image size (~220mb); unfortunately the grpc-swift plugins cause it to blow out as they're statically linked (so don't need foundation or the swift dependencies).
Not copying them across will save ~100mb in space.
## TODOS
- Build the swift plugins inside this repo, 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 c grpc plugins - [CMake dockerfile](https://hub.docker.com/r/kitware/cmake)

View File

@@ -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 .

Binary file not shown.

Binary file not shown.