Fix version injection for docker builds

- Add OLLAMA_VERSION build arg to Dockerfiles
- Update Makefile to pass version via --build-arg
- Add .env.example as local development reference
- Update build.yml to use cicd-1 environment for vars.OLLAMA_VERSION

Fixes #8

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Shang Chieh Tseng
2025-12-17 00:42:04 +08:00
parent f25016b7d5
commit 1e99c1bb50
5 changed files with 35 additions and 5 deletions

View File

@@ -32,7 +32,9 @@ RUN bash -c 'LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:/usr/lib64:$LD_LIBR
# Build Go binary
# VCS info is embedded automatically since we cloned from git
# Build to source directory so binary can find libraries via relative path
RUN go build -o ./ollama .
# Set version via -ldflags - pass OLLAMA_VERSION as build arg
ARG OLLAMA_VERSION
RUN go build -ldflags "-X github.com/ollama/ollama/version.Version=${OLLAMA_VERSION}" -o ./ollama .
# Create symlink to standard binary location
# The code in ml/path.go uses filepath.EvalSymlinks() which resolves this symlink

View File

@@ -36,7 +36,9 @@ RUN bash -c 'LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:/usr/lib64:$LD_LIBR
# Build Go binary
# Build to source directory so binary can find libraries via relative path
RUN go build -o ./ollama .
# Set version via -ldflags - pass OLLAMA_VERSION as build arg
ARG OLLAMA_VERSION
RUN go build -ldflags "-X github.com/ollama/ollama/version.Version=${OLLAMA_VERSION}" -o ./ollama .
# Create symlink to standard binary location
# The code in ml/path.go uses filepath.EvalSymlinks() which resolves this symlink