Closed surajbarkale closed 4 years ago
Hello! What is the current status of this PR? This feature would be really cool.
Apologies for the delay. I have been a bit out of the loop/busy. I will take a look at this tonight. Thank you for putting this up.
Looks good. Can you run make dockerall
to verify the container builds correctly and that the Docker tests all work?
I have added tests and fixed issues with make dockerall
. However, there is now a substantial change in the Dockerfile.
I also found out that statically linked swift executables do not work on Linux! https://bugs.swift.org/browse/SR-648
Yeah so I'd really rather not add this level of complexity to the Dockerfile all for the sake of adding in Swift. Our preference is for you to build your own image based on uber/prototool
anyway.
See here: https://github.com/uber/prototool/blob/dev/docs/docker.md
Here is the gist of changes I have made to the image:
Bumped GRPC version to 1.25.0 and protobuf version to 3.11.2. Running make dockerall
on master is failing because the existing versions are no longer available in alpine:edge.
Use alpine:3.11 instead of alpine:edge. Since alpine 3.10 contains older version of GRPC and protobuf than master.
Changed go version to 1.13 since the go.mod file in master specifies this version.
Move all version definitions to start of the Dockerfile and reuse these in build steps. This is a cleanup and makes it easier to check build versions.
Split builder image into base & builder image. Otherwise the swift builder was always re-run.
Added swift builder image as an independent image.
Changes 1, 2 & 3 are needed to fix make dockerall
on master. Change 4 is an enhancement (you may disagree). Changes 5 & 6 bring in swift support.
I am documenting this here in case anyone wants to reuse code in this PR. Please feel free to close this PR if you don't want to merge it.
I think Steps 1-4 are valid. I am in the process of actually upgrading dependencies now. The dev
branch should have most go.mod
and protoc
updates, but the Bazel build is failing, so I need to work that out. So, I would say Steps 1-3 I can take care of.
Step 4 is also a valid thing. I'd definitely welcome a PR of that if possible.
And yeah, I think I'd rather not do Steps 5-6 right now. Apologies, but at least you can use that code to build your own image based on the Prototool image.
Going to close this PR. If you decide to implement Step 4 in our above convo, please open a new PR.
This PR adds
protoc-gen-swift
tool from https://github.com/apple/swift-protobuf to the docker image. Since swift does not support static linking, I had to explicitly copy all .so dependencies into the final image. Since all other tools are statically linked, copying over glibc works.I have tested locally by adding generate clause in
prototool.yaml
:Please let me know if any explicit tests have to be added.
I understand this PR may be rejected because of future conflicts with glibc. However, this will help someone who is using prototool and needs to generate swift bindings.