diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..43fb9b2e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM rust +WORKDIR /usr/src/tipb-build +RUN apt update && apt install unzip golang cmake -y +RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v3.5.1/protoc-3.5.1-linux-x86_64.zip +RUN unzip protoc-3.5.1-linux-x86_64.zip +ENV PATH="/usr/src/tipb-build/bin:/root/go/bin:${PATH}" +WORKDIR /tipb +ENTRYPOINT ["/usr/bin/make"] +CMD ["all"] diff --git a/README.md b/README.md index de9f88c4..e56e3e86 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,38 @@ TiDB protobuf files -## Requirements +## Build with local toolchain ### Install [google/protobuf](https://github.com/google/protobuf) We use `protoc` 3.5.1, to download: [protobuf/releases/tag/v3.5.1](https://github.com/google/protobuf/releases/tag/v3.5.1) -## Generate the Go and Rust codes +### Generate the Go and Rust codes ```sh make ``` -NOTE: Do not forget to update the dependent projects! +## Build with docker + +### Build the docker image + +```sh +docker build . -t tipb-builder +``` + +### Generate codes + +Basically just use the docker image instead of `make`: + +```sh +# Generate All codes +docker run -v $(pwd):/tipb tipb-builder +# Generate Go codes only +docker run -v $(pwd):/tipb tipb-builder go +# Generate Rust codes only +docker run -v $(pwd):/tipb tipb-builder rust +``` + +## Note +Do not forget to update the dependent projects!