-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade Golang and dependencies versions. (#27)
# Upgrade Golang and Dependencies to Improve Performance and Security ## Overview This pull request introduces significant updates to the `keess` project, focusing on upgrading Golang and various dependencies to their latest versions. ## Key Changes 1. **Golang Upgrade:** Updated to version 1.21, ensuring compatibility with the latest features and security patches. 2. **Dependencies Update:** Modified the `go.mod` file to include the latest versions of our dependencies, enhancing the project's stability and performance. 3. **Dockerfile and Makefile Adjustments:** Reflected the Golang version upgrade and tweaked the build process for better efficiency. 4. **Chart Updates:** Made necessary updates to `Chart.yaml` and `values.yaml` to align with the current project configuration. ## Benefits - **Enhanced Security:** The latest versions of Golang and dependencies include important security fixes. - **Improved Performance:** The upgrades contribute to better overall performance of the application. - **Future-Proofing:** These updates ensure that our project stays up-to-date with the latest technological standards.
- Loading branch information
Showing
8 changed files
with
1,288 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,3 +36,5 @@ apiserver.local.config/** | |
.DS_Store | ||
.vscode | ||
keess | ||
coverage.* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,34 @@ | ||
# Build | ||
FROM --platform=linux/amd64 golang:1.19 as build | ||
# Stage 1: Build the Go application | ||
FROM golang:1.21-alpine AS builder | ||
|
||
WORKDIR /app | ||
COPY . ./ | ||
# Set necessary environmet variables needed for our image | ||
ENV GO111MODULE=on \ | ||
CGO_ENABLED=0 \ | ||
GOOS=linux \ | ||
GOARCH=amd64 | ||
|
||
# Move to working directory /build | ||
WORKDIR /build | ||
|
||
# Copy and download dependency using go mod | ||
COPY go.mod . | ||
COPY go.sum . | ||
RUN go mod download | ||
|
||
# Copy the code into the container | ||
COPY . . | ||
|
||
# Run tests | ||
RUN go test ./... | ||
RUN go build -o /keess | ||
|
||
# Run | ||
FROM --platform=linux/amd64 ubuntu | ||
# Build the application | ||
RUN go build -o keess . | ||
|
||
# Stage 2: Build a small image | ||
FROM alpine | ||
|
||
WORKDIR / | ||
COPY --from=build /keess /keess | ||
# Copy the binary from the builder stage | ||
COPY --from=builder /build/keess /app/keess | ||
|
||
ENTRYPOINT ["./keess", "run"] | ||
# Command to run | ||
ENTRYPOINT ["/app/keess", "run"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Project variables | ||
PROJECT_NAME := "keess" | ||
DOCKER_IMAGE_NAME := "keess" | ||
DOCKER_TAG := "latest" | ||
|
||
# Go related variables | ||
GOBASE := $(shell pwd) | ||
GOBIN := $(GOBASE)/bin | ||
|
||
.PHONY: build test docker-build coverage run docker-run help | ||
|
||
# Build the project | ||
build: | ||
@echo "Building $(PROJECT_NAME)..." | ||
@GOBIN=$(GOBIN) go build -o $(GOBIN)/$(PROJECT_NAME) $(GOBASE) | ||
|
||
# Run tests | ||
test: | ||
@echo "Running tests..." | ||
@go test ./... | ||
|
||
# Build Docker image | ||
docker-build: | ||
@echo "Building Docker image..." | ||
|
||
# Remove the existing builder | ||
@docker buildx rm mybuilder | ||
@docker buildx create --name mybuilder --use | ||
@docker buildx build --platform linux/amd64,linux/arm64 -t $(DOCKER_IMAGE_NAME):$(DOCKER_TAG) . | ||
|
||
# New target for code coverage | ||
coverage: | ||
@echo "Generating code coverage..." | ||
@go test ./... -coverprofile=coverage.out | ||
@go tool cover -html=coverage.out -o coverage.html | ||
@echo "Opening code coverage report in browser..." | ||
@open coverage.html | ||
|
||
# Target to execute the application | ||
run: build | ||
@echo "Running the application..." | ||
@./bin/keess run | ||
|
||
# Target to run the Docker image with the .kube directory mounted | ||
docker-run: | ||
@echo "Running Docker image with .kube directory mounted..." | ||
@docker run --rm -it -v ${HOME}/.kube:/root/.kube $(DOCKER_IMAGE_NAME):$(DOCKER_TAG) | ||
|
||
# Help | ||
help: | ||
@echo "Makefile commands:" | ||
@echo "build - Build the project" | ||
@echo "test - Run tests" | ||
@echo "docker-build - Build Docker image" | ||
@echo "coverage - Generate and view code coverage report" | ||
@echo "run - Run the application" | ||
@echo "docker-run - Run the Docker image with .kube directory mounted" | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.