-
Notifications
You must be signed in to change notification settings - Fork 0
Add docker cloudbuild setup #4
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 all commits
4112866
cd85aae
9ce38f5
85a715f
c7792cb
591869f
c296705
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,5 @@ | ||
| bazel-* | ||
| builds/ | ||
| .git | ||
| .circleci | ||
| .github |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # Build stage — compile everything with Bazel | ||
| FROM ubuntu:24.04 AS builder | ||
|
|
||
| RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ | ||
| build-essential \ | ||
| git \ | ||
| openjdk-21-jdk-headless \ | ||
| python3 \ | ||
| curl \ | ||
| zip \ | ||
| unzip \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Install Bazelisk (manages Bazel version via .bazelversion) | ||
| RUN curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.25.0/bazelisk-linux-amd64 \ | ||
| -o /usr/local/bin/bazel && chmod +x /usr/local/bin/bazel | ||
|
|
||
| RUN useradd -m builder && mkdir -p /output && chown builder /output | ||
| WORKDIR /src | ||
| COPY --chown=builder . . | ||
|
|
||
| # Use CI bazelrc for optimized builds | ||
| RUN cp .bazelrc.ci .bazelrc | ||
|
|
||
| USER builder | ||
| RUN bazel build :livegrep \ | ||
| && mkdir -p /output \ | ||
| && tar -C /output -xf "$(bazel info bazel-bin)/livegrep.tar" | ||
|
cursor[bot] marked this conversation as resolved.
|
||
|
|
||
| # Runtime stage | ||
| FROM ubuntu:24.04 | ||
|
|
||
| RUN apt-get update \ | ||
| && apt-get -y dist-upgrade \ | ||
| && DEBIAN_FRONTEND=noninteractive apt-get install -y \ | ||
| git \ | ||
| openssh-client \ | ||
| ca-certificates \ | ||
| && apt-get clean \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| COPY --from=builder /output/ /livegrep/ | ||
|
sentry[bot] marked this conversation as resolved.
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. Dockerfile missing CMD or ENTRYPOINT directiveHigh Severity The runtime stage of the Dockerfile copies the built livegrep binaries but doesn't specify a |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| steps: | ||
| # Build the container image | ||
| - name: 'gcr.io/cloud-builders/docker' | ||
| args: | ||
| - 'build' | ||
| - '-t' | ||
| - 'us-west2-docker.pkg.dev/$PROJECT_ID/$REPO_NAME/image:$COMMIT_SHA' | ||
|
trevor-e marked this conversation as resolved.
|
||
| - '-t' | ||
| - 'us-west2-docker.pkg.dev/$PROJECT_ID/$REPO_NAME/image:$SHORT_SHA' | ||
| - '-t' | ||
| - 'us-west2-docker.pkg.dev/$PROJECT_ID/$REPO_NAME/image:latest' | ||
| - '.' | ||
|
|
||
| # Push all tags | ||
| - name: 'gcr.io/cloud-builders/docker' | ||
| args: | ||
| - 'push' | ||
| - '--all-tags' | ||
| - 'us-west2-docker.pkg.dev/$PROJECT_ID/$REPO_NAME/image' | ||
|
|
||
| # Deploy to Cloud Run service | ||
| - name: 'gcr.io/cloud-builders/gcloud' | ||
| args: | ||
| - 'run' | ||
| - 'services' | ||
| - 'update' | ||
| - 'livegrep-web-and-server' | ||
| - '--region=us-west2' | ||
| - '--image=us-west2-docker.pkg.dev/$PROJECT_ID/$REPO_NAME/image:$COMMIT_SHA' | ||
|
sentry[bot] marked this conversation as resolved.
trevor-e marked this conversation as resolved.
|
||
|
|
||
| # Deploy to Cloud Run indexer job | ||
| - name: 'gcr.io/cloud-builders/gcloud' | ||
| args: | ||
| - 'run' | ||
| - 'jobs' | ||
| - 'update' | ||
| - 'livegrep-indexer' | ||
| - '--region=us-west2' | ||
| - '--image=us-west2-docker.pkg.dev/$PROJECT_ID/$REPO_NAME/image:$COMMIT_SHA' | ||
|
|
||
| images: | ||
| - 'us-west2-docker.pkg.dev/$PROJECT_ID/$REPO_NAME/image:$COMMIT_SHA' | ||
| - 'us-west2-docker.pkg.dev/$PROJECT_ID/$REPO_NAME/image:$SHORT_SHA' | ||
| - 'us-west2-docker.pkg.dev/$PROJECT_ID/$REPO_NAME/image:latest' | ||
|
|
||
| timeout: 3600s | ||
|
|
||
| options: | ||
| machineType: 'E2_HIGHCPU_8' | ||
| logging: CLOUD_LOGGING_ONLY | ||


Uh oh!
There was an error while loading. Please reload this page.