Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Add docker based building infrastructure #259

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!