-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: wangweijie <[email protected]>
- Loading branch information
Showing
2 changed files
with
103 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
From bf8a246daf77b8df65bcacf81fc2c064e15b2a80 Mon Sep 17 00:00:00 2001 | ||
From: zhangguanzhang <[email protected]> | ||
Date: Mon, 25 Sep 2023 15:24:29 +0800 | ||
Subject: [PATCH] support loong64 | ||
|
||
--- | ||
Makefile | 2 +- | ||
cmd/loki/Dockerfile | 6 ++++-- | ||
vendor/go.etcd.io/bbolt/bolt_loong64.go | 10 ++++++++++ | ||
3 files changed, 15 insertions(+), 3 deletions(-) | ||
create mode 100644 vendor/go.etcd.io/bbolt/bolt_loong64.go | ||
|
||
diff --git a/Makefile b/Makefile | ||
index 6a0950ed7..bc7d813ba 100644 | ||
--- a/Makefile | ||
+++ b/Makefile | ||
@@ -549,7 +549,7 @@ promtail-push: promtail-image-cross | ||
|
||
# loki | ||
loki-image: | ||
- $(SUDO) docker build -t $(IMAGE_PREFIX)/loki:$(IMAGE_TAG) -f cmd/loki/Dockerfile . | ||
+ $(SUDO) docker build $(DOCKER_BUILD_ARGS) -t $(IMAGE_PREFIX)/loki:$(IMAGE_TAG) -f cmd/loki/Dockerfile . | ||
loki-image-cross: | ||
$(SUDO) $(BUILD_OCI) -t $(IMAGE_PREFIX)/loki:$(IMAGE_TAG) -f cmd/loki/Dockerfile.cross . | ||
|
||
diff --git a/cmd/loki/Dockerfile b/cmd/loki/Dockerfile | ||
index dad23df2f..59ea87127 100644 | ||
--- a/cmd/loki/Dockerfile | ||
+++ b/cmd/loki/Dockerfile | ||
@@ -1,10 +1,12 @@ | ||
-FROM golang:1.20.7 as build | ||
+ARG GO_IMG=golang:1.20.7 | ||
+ARG BASE_IMG=alpine:3.18.3 | ||
+FROM ${GO_IMG} as build | ||
|
||
COPY . /src/loki | ||
WORKDIR /src/loki | ||
RUN make clean && make BUILD_IN_CONTAINER=false loki | ||
|
||
-FROM alpine:3.18.3 | ||
+FROM ${BASE_IMG} | ||
|
||
RUN apk add --no-cache ca-certificates libcap | ||
|
||
diff --git a/vendor/go.etcd.io/bbolt/bolt_loong64.go b/vendor/go.etcd.io/bbolt/bolt_loong64.go | ||
new file mode 100644 | ||
index 000000000..31c17c1d0 | ||
--- /dev/null | ||
+++ b/vendor/go.etcd.io/bbolt/bolt_loong64.go | ||
@@ -0,0 +1,10 @@ | ||
+//go:build loong64 | ||
+// +build loong64 | ||
+ | ||
+package bbolt | ||
+ | ||
+// maxMapSize represents the largest mmap size supported by Bolt. | ||
+const maxMapSize = 0xFFFFFFFFFFFF // 256TB | ||
+ | ||
+// maxAllocSize is the size used when creating array pointers. | ||
+const maxAllocSize = 0x7FFFFFFF | ||
-- | ||
2.25.1 | ||
|
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,40 @@ | ||
# This file is generated by the template. | ||
|
||
REGISTRY?=lcr.loongnix.cn | ||
ORGANIZATION?=grafana | ||
REPOSITORY?=loki | ||
TAG?=2.8.5 | ||
LATEST?=false | ||
|
||
IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG) | ||
LATEST_IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):latest | ||
|
||
# SOURCE_URL is a url to download source, such as https://github.com/merore/merore.git. | ||
# SOURCE is project sources, its located at src/$(SORUCE). | ||
# PATCH is a patch that supports loong64 to $(SOURCE). | ||
# Be sure to fill in the follows!!! | ||
SOURCE_URL=https://github.com/$(ORGANIZATION)/$(REPOSITORY).git | ||
SOURCE=$(shell echo $(SOURCE_URL) | awk -F '/' '{print $$NF}' | awk -F '.' '{print $$1}') | ||
PATCH=0001-support-loong64.patch | ||
|
||
default: image | ||
|
||
src/$(SOURCE): | ||
git clone -b v$(TAG) --depth=1 $(SOURCE_URL) $@ | ||
cd $@ && \ | ||
git apply ../../$(PATCH) | ||
|
||
|
||
image: src/$(SOURCE) | ||
# Commands for building. | ||
IMAGE_PREFIX=$(REGISTRY)/$(ORGANIZATION) \ | ||
DOCKER_BUILD_ARGS="--build-arg BASE_IMG=lcr.loongnix.cn/library/alpine:3.19 \ | ||
--build-arg https_proxy=${https_proxy} --build-arg http_proxy=${http_proxy} \ | ||
--build-arg GO_IMG=lcr.loongnix.cn/library/golang:1.21.6" \ | ||
$(MAKE) -C src/$(SOURCE) loki-image | ||
|
||
push: | ||
docker push $(IMAGE) | ||
|
||
clean: | ||
rm -rf src |