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

🐛 #217: Set build info correctly in Glide images #218

Merged
merged 2 commits into from
Apr 27, 2024
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Bringing support for streaming chat in Glide.
- 🔧 [chores] Automatic coverage reports #39 (@roma-glushko)
- 👷 [build] Setup release workflows #9 (@roma-glushko)

[unreleased]: https://github.com/olivierlacan/keep-a-changelog/compare/0.0.3...HEAD
[unreleased]: https://github.com/EinStack/glide/compare/0.0.3...HEAD
[0.0.3]: https://github.com/EinStack/glide/compare/0.0.3-rc.1..0.0.3
[0.0.3-rc.2]: https://github.com/EinStack/glide/compare/0.0.3-rc.1..0.0.3-rc.2
[0.0.3-rc.1]: https://github.com/EinStack/glide/compare/0.0.2..0.0.3-rc.1
Expand Down
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
CHECKER_BIN=$(PWD)/tmp/bin
VERSION_PACKAGE := glide/pkg
VERSION_PACKAGE := glide/pkg/version
COMMIT ?= $(shell git describe --dirty --long --always --abbrev=15)
BUILD_DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
VERSION ?= "latest"

LDFLAGS_COMMON := "-s -w -X $(VERSION_PACKAGE).commitSha=$(COMMIT) -X $(VERSION_PACKAGE).version=$(VERSION) -X $(VERSION_PACKAGE).buildDate=$(BUILD_DATE)"
LDFLAGS_COMMON := "-s -w -X $(VERSION_PACKAGE).commitSha=$(COMMIT) -X $(VERSION_PACKAGE).Version=$(VERSION) -X $(VERSION_PACKAGE).buildDate=$(BUILD_DATE)"

.PHONY: help

Expand Down Expand Up @@ -40,7 +40,11 @@ run: ## Run Glide
@go run -ldflags $(LDFLAGS_COMMON) main.go -c ./config.dev.yaml

build: ## Build Glide
@go build -ldflags $(LDFLAGS_COMMON) -o ./dist/glide
@echo "🔨Building Glide binary.."
@echo "Version: $(VERSION)"
@echo "Commit: $(COMMIT)"
@echo "Build Date: $(BUILD_DATE)"
@go build -ldflags $(LDFLAGS_COMMON) -o ./dist/glide;

test: ## Run tests
@go test -v -count=1 -race -shuffle=on -coverprofile=coverage.txt ./...
Expand Down
3 changes: 1 addition & 2 deletions images/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ VENDOR ?= einstack
PROJECT ?= Glide
SOURCE ?= https://github.com/EinStack/glide
LICENSE ?= Apache-2.0
DESCRIPTION ?= "A lightweight, cloud-native LLM gateway"
DESCRIPTION ?= "A lightweight, cloud-native fast LLM gateway"
REPOSITORY ?= einstack/glide

VERSION ?= dev
RC_PART ?= rc
COMMIT ?= $(shell git describe --dirty --always --abbrev=15)
BUILD_DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")


# OCI Labels: https://specs.opencontainers.org/image-spec/annotations
# Test images via: docker run --rm --platform linux/amd64 -i einstack/glide:dev-alpine --config config.dev.yaml

Expand Down
2 changes: 1 addition & 1 deletion images/alpine.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ WORKDIR /build

COPY . /build/
RUN go mod download
RUN go build -ldflags "-s -w -X glide/pkg.version=$VERSION -X glide/pkg.commitSha=$COMMIT -X glide/pkg.buildDate=$BUILD_DATE" -o /build/dist/glide
RUN go build -ldflags "-s -w -X glide/pkg/version.Version=$VERSION -X glide/pkg/version.commitSha=$COMMIT -X glide/pkg/version.buildDate=$BUILD_DATE" -o /build/dist/glide

FROM alpine:3.19 as release

Expand Down
2 changes: 1 addition & 1 deletion images/distroless.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ WORKDIR /build

COPY . /build/
RUN go mod download
RUN go build -ldflags "-s -w -X glide/pkg.version=$VERSION -X glide/pkg.commitSha=$COMMIT -X glide/pkg.buildDate=$BUILD_DATE" -o /build/dist/glide
RUN go build -ldflags "-s -w -X glide/pkg/version.Version=$VERSION -X glide/pkg/version.commitSha=$COMMIT -X glide/pkg/version.buildDate=$BUILD_DATE" -o /build/dist/glide

FROM gcr.io/distroless/static-debian12:nonroot as release

Expand Down
2 changes: 1 addition & 1 deletion images/redhat.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ WORKDIR /build

COPY . /build/
RUN go mod download
RUN go build -ldflags "-s -w -X glide/pkg.version=$VERSION -X glide/pkg.commitSha=$COMMIT -X glide/pkg.buildDate=$BUILD_DATE" -o /build/dist/glide
RUN go build -ldflags "-s -w -X glide/pkg/version.version=$VERSION -X glide/pkg/version.commitSha=$COMMIT -X glide/pkg/version.buildDate=$BUILD_DATE" -o /build/dist/glide

FROM redhat/ubi8-micro:8.9 as release

Expand Down
2 changes: 1 addition & 1 deletion images/ubuntu.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ WORKDIR /build

COPY . /build/
RUN go mod download
RUN go build -ldflags "-s -w -X glide/pkg.version=$VERSION -X glide/pkg.commitSha=$COMMIT -X glide/pkg.buildDate=$BUILD_DATE" -o /build/dist/glide
RUN go build -ldflags "-s -w -X glide/pkg/version.version=$VERSION -X glide/pkg/version.commitSha=$COMMIT -X glide/pkg/version.buildDate=$BUILD_DATE" -o /build/dist/glide

FROM ubuntu:22.04 as release

Expand Down
Loading