Skip to content
Merged
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
4 changes: 2 additions & 2 deletions Demos/Gemma-on-Cloudrun/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# === Stage 1: Build proxy server ===
FROM golang:1.24-alpine as proxy_builder
FROM golang:1.24.13-alpine as proxy_builder
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The proxy_builder stage uses an Alpine-based image, which uses musl as its C standard library. The final ollama_builder stage is based on ollama/ollama:latest, which is Ubuntu-based and uses glibc. A Go binary compiled on Alpine may be dynamically linked against musl (if CGO is used, which is the default for packages like net/http), causing it to fail at runtime in the glibc-based environment due to library incompatibility.

The pull request description mentions, "Switches to bullseye base image to ensure GLIBC compatibility," but this change wasn't applied. To ensure compatibility, you should switch to a glibc-based builder image like bullseye.

FROM golang:1.24.13-bullseye as proxy_builder

LABEL stage="proxy-builder"

# Create and change to the app directory.
Expand All @@ -21,7 +21,7 @@ FROM ollama/ollama:latest as ollama_builder
LABEL stage="ollama-builder"

# Install curl. It's used in the start_script.sh to check Ollama health status.
RUN apt-get update && apt-get install -y curl
RUN apt-get update && apt-get upgrade -y && apt-get install -y curl
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To optimize the Docker image size, it's a good practice to clean up the apt cache after installing packages. Additionally, using --no-install-recommends can prevent the installation of unnecessary packages, further reducing the image size.

RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To reduce the final image size and potential attack surface, it's a best practice to clean up apt cache after installation and avoid installing recommended packages that are not strictly necessary.

RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To optimize the Docker image size, it's a good practice to clean up the apt cache in the same RUN layer after installing packages. This prevents the cache from being stored in the layer, reducing the final image size. Also, using --no-install-recommends can prevent installing unnecessary packages.

RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*


# Copy the proxy server binary to the ollama image.
COPY --from=proxy_builder /app/server /app/server
Expand Down
18 changes: 10 additions & 8 deletions Demos/Gemma-on-Cloudrun/go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
module cloudrungemma

go 1.24
go 1.24.0

toolchain go1.24.13

require (
cloud.google.com/go/ai v0.10.2
github.com/openai/openai-go v0.1.0-beta.10
google.golang.org/protobuf v1.36.6
google.golang.org/protobuf v1.36.10
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The version v1.36.10 for google.golang.org/protobuf appears to be invalid. The latest published version for this module is v1.34.1. Using a non-existent version will cause go get to fail and break the build. Please use a valid, published version.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

)

require (
Expand All @@ -14,10 +16,10 @@ require (
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tidwall/sjson v1.2.5 // indirect
golang.org/x/net v0.39.0 // indirect
golang.org/x/sys v0.32.0 // indirect
golang.org/x/text v0.24.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250414145226-207652e42e2e // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250414145226-207652e42e2e // indirect
google.golang.org/grpc v1.71.1 // indirect
golang.org/x/net v0.48.0 // indirect
golang.org/x/sys v0.39.0 // indirect
golang.org/x/text v0.32.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect
google.golang.org/grpc v1.79.3 // indirect
Comment on lines +19 to +24
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The versions for these indirect dependencies appear to be invalid as they don't correspond to published versions. For example:

  • golang.org/x/net: v0.48.0 is not a valid version (latest is v0.25.0).
  • google.golang.org/grpc: v1.79.3 is not a valid version (latest is v1.64.0).

This will cause build failures. Please ensure all dependency versions are valid and published.

)