-
Notifications
You must be signed in to change notification settings - Fork 16
Build proto in Docker #173
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| FROM ubuntu:24.04 | ||
|
|
||
| RUN apt-get update \ | ||
| && DEBIAN_FRONTEND=noninteractive \ | ||
| apt-get install -y \ | ||
| curl \ | ||
| unzip \ | ||
| build-essential \ | ||
| pkg-config \ | ||
| libssl-dev \ | ||
| ca-certificates \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| ARG RUST_TOOLCHAIN | ||
| RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${RUST_TOOLCHAIN} | ||
| ENV PATH="/root/.cargo/bin:${PATH}" | ||
|
|
||
| ARG PROTOC_VERSION | ||
| RUN curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip \ | ||
| && unzip protoc-${PROTOC_VERSION}-linux-x86_64.zip -d /usr/local \ | ||
| && rm protoc-${PROTOC_VERSION}-linux-x86_64.zip | ||
|
|
||
| ARG GO_VERSION | ||
| RUN curl -OL https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz \ | ||
| && tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz \ | ||
| && rm go${GO_VERSION}.linux-amd64.tar.gz | ||
| ENV PATH="/usr/local/go/bin:${PATH}" | ||
|
|
||
| ARG PROTOC_GEN_GO_VERSION | ||
| RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@${PROTOC_GEN_GO_VERSION} | ||
| ENV PATH="/root/go/bin:${PATH}" | ||
|
|
||
| ARG NODE_VERSION | ||
| RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - \ | ||
| && apt-get install -y nodejs | ||
|
|
||
| WORKDIR /workspace |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)" | ||
| IMAGE_NAME="omes-ks-gen" | ||
|
|
||
| # Always load versions from versions.env | ||
| set -a && source "${PROJECT_ROOT}/versions.env" && set +a | ||
|
|
||
| echo "Building Docker image for kitchen-sink-gen..." | ||
| docker build -f "${PROJECT_ROOT}/dockerfiles/proto.Dockerfile" \ | ||
| --build-arg RUST_TOOLCHAIN="${RUST_TOOLCHAIN}" \ | ||
| --build-arg GO_VERSION="${GO_VERSION}" \ | ||
| --build-arg PROTOC_VERSION="${PROTOC_VERSION}" \ | ||
| --build-arg PROTOC_GEN_GO_VERSION="${PROTOC_GEN_GO_VERSION}" \ | ||
| --build-arg NODE_VERSION="${NODE_VERSION}" \ | ||
| -t "${IMAGE_NAME}" "${PROJECT_ROOT}" | ||
|
|
||
| echo "Running kitchen-sink-gen build..." | ||
| docker run --rm -v "${PROJECT_ROOT}:/workspace" -w /workspace "${IMAGE_NAME}" bash -c " | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a huge fan of mounting the whole project dir into the docker image. This can make for slow loads as it copies everything, and what it writes back out often has weird, incorrect permissions. That said, this is still easier than before, so I wouldn't block on this, but, if possible might be nice to cleanly copy the result files out.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 Good idea!
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, I spent almost an hour on this and it's harder than I thought: I don't want to copy all files into the container (node_modules is large) which requires some filtering, I don't want to specify every single output because that's brittle, but copying all files out of the container also defeats the purpose, doing a diff is harder than it seems, ... I'll merge for now and we can discuss improvements. |
||
| cd /workspace/loadgen/kitchen-sink-gen | ||
| cargo build | ||
| cd /workspace/workers/typescript | ||
| npm install && npm run proto-gen | ||
|
Comment on lines
+25
to
+26
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Easy to forget ... |
||
| " | ||
|
|
||
| echo "✅ kitchen-sink-gen build complete!" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # Tool versions | ||
| GO_VERSION=1.21.0 | ||
| JAVA_VERSION=11 | ||
| NODE_VERSION=22 | ||
| PROTOC_GEN_GO_VERSION=v1.31.0 | ||
| PROTOC_VERSION=25.1 | ||
| PYTHON_VERSION=3.10 | ||
| RUST_TOOLCHAIN=1.74.0 | ||
|
|
||
| # SDK versions | ||
| DOTNET_SDK_VERSION=1.7.0 | ||
| GO_SDK_VERSION=1.35.0 | ||
| JAVA_SDK_VERSION=1.30.1 | ||
| PYTHON_SDK_VERSION=1.14.1 | ||
| TYPESCRIPT_SDK_VERSION=1.12.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth changing this to say you either need proto or docker to get kitchen sink going locally