-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/qiangxuhui/dockerfiles into…
… main
- Loading branch information
Showing
7 changed files
with
222 additions
and
4 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,82 @@ | ||
From bd6b2f4a97deeb4fec0d8054ef7fddd78b9be919 Mon Sep 17 00:00:00 2001 | ||
From: Lan Liang <[email protected]> | ||
Date: Tue, 9 Jul 2024 03:59:09 +0000 | ||
Subject: [PATCH] support-loong64 | ||
|
||
Signed-off-by: Lan Liang <[email protected]> | ||
--- | ||
Dockerfile-release.loong64 | 15 +++++++++++++++ | ||
Makefile | 8 +++++--- | ||
server/etcdmain/etcd.go | 1 + | ||
3 files changed, 21 insertions(+), 3 deletions(-) | ||
create mode 100644 Dockerfile-release.loong64 | ||
|
||
diff --git a/Dockerfile-release.loong64 b/Dockerfile-release.loong64 | ||
new file mode 100644 | ||
index 000000000..cd94364bb | ||
--- /dev/null | ||
+++ b/Dockerfile-release.loong64 | ||
@@ -0,0 +1,15 @@ | ||
+ARG BASE_IMG=cr.loongnix.cn/prometheus/busybox:glibc | ||
+FROM ${BASE_IMG} | ||
+ENV ETCD_UNSUPPORTED_ARCH=loong64 | ||
+ | ||
+COPY etcd /usr/local/bin/ | ||
+COPY etcdctl /usr/local/bin/ | ||
+COPY etcdutl /usr/local/bin/ | ||
+ | ||
+WORKDIR /var/etcd/ | ||
+WORKDIR /var/lib/etcd/ | ||
+ | ||
+EXPOSE 2379 2380 | ||
+ | ||
+# Define default command. | ||
+CMD ["/usr/local/bin/etcd"] | ||
\ No newline at end of file | ||
diff --git a/Makefile b/Makefile | ||
index 8cfd790e0..f122e3d7f 100644 | ||
--- a/Makefile | ||
+++ b/Makefile | ||
@@ -53,7 +53,8 @@ docker-remove: | ||
docker rm --force `docker ps -a -q` || true | ||
docker rmi --force `docker images -q` || true | ||
|
||
- | ||
+IMAGE ?= gcr.io/etcd-development/etcd:$(ETCD_VERSION) | ||
+BASE_IMG ?= cr.loongnix.cn/prometheus/busybox:glibc | ||
|
||
GO_VERSION ?= $(shell cat .go-version) | ||
ETCD_VERSION ?= $(shell git rev-parse --short HEAD || echo "GitNotFound") | ||
@@ -223,14 +224,15 @@ build-docker-release-main: | ||
cp ./Dockerfile-release.$(ARCH) ./bin/Dockerfile-release.$(ARCH) | ||
docker build \ | ||
--network=host \ | ||
- --tag gcr.io/etcd-development/etcd:$(ETCD_VERSION) \ | ||
+ --build-arg BASE_IMG=$(BASE_IMG) \ | ||
+ --tag $(IMAGE) \ | ||
--file ./bin/Dockerfile-release.$(ARCH) \ | ||
./bin | ||
rm -f ./bin/Dockerfile-release.$(ARCH) | ||
|
||
docker run \ | ||
--rm \ | ||
- gcr.io/etcd-development/etcd:$(ETCD_VERSION) \ | ||
+ $(IMAGE) \ | ||
/bin/sh -c "/usr/local/bin/etcd --version && /usr/local/bin/etcdctl version && /usr/local/bin/etcdutl version" | ||
|
||
push-docker-release-main: | ||
diff --git a/server/etcdmain/etcd.go b/server/etcdmain/etcd.go | ||
index 9921b89df..0ac9c6737 100644 | ||
--- a/server/etcdmain/etcd.go | ||
+++ b/server/etcdmain/etcd.go | ||
@@ -471,6 +471,7 @@ func checkSupportArch() { | ||
// to add a new platform, check https://github.com/etcd-io/website/blob/main/content/en/docs/next/op-guide/supported-platform.md | ||
if runtime.GOARCH == "amd64" || | ||
runtime.GOARCH == "arm64" || | ||
+ runtime.GOARCH == "loong64" || | ||
runtime.GOARCH == "ppc64le" || | ||
runtime.GOARCH == "s390x" { | ||
return | ||
-- | ||
2.45.2 | ||
|
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,52 @@ | ||
# This file is generated by the template. | ||
|
||
REGISTRY?=cr.loongnix.cn | ||
ORGANIZATION?=kubernetes | ||
REPOSITORY?=etcd | ||
TAG?=v3.5.14 | ||
LATEST?=true | ||
|
||
GO_IMG?=cr.loongnix.cn/library/golang:1.21 | ||
GOPROXY=https://goproxy.cn,https://mirrors.aliyun.com/goproxy/,https://goproxy.io,direct | ||
|
||
IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(patsubst v%,%,$(TAG)) | ||
LATEST_IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):latest | ||
|
||
SOURCE_URL=https://github.com/etcd-io/etcd.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 $(TAG) --depth=1 $(SOURCE_URL) $@ | ||
cd $@ && \ | ||
git apply ../../$(PATCH) | ||
|
||
build: src/$(SOURCE) | ||
docker run --rm \ | ||
-e GOARCH=loong64 \ | ||
-e ETCD_UNSUPPORTED_ARCH=loong64 \ | ||
-e GOPROXY=$(GOPROXY) \ | ||
-e FORCE_HOST_GO=1 \ | ||
-e HTTPS_PROXY=$(http_proxy) -e HTTP_PROXY=$(http_proxy) \ | ||
-v `pwd`/src/$(SOURCE):/v -w /v \ | ||
$(GO_IMG) make build | ||
|
||
|
||
image: src/$(SOURCE) build | ||
export ETCD_UNSUPPORTED_ARCH=loong64 && \ | ||
ARCH=loong64 IMAGE=$(IMAGE) \ | ||
BASE_IMG=cr.loongnix.cn/prometheus/busybox:glibc \ | ||
make -C src/$(SOURCE) build-docker-release-main | ||
|
||
push: | ||
docker push $(IMAGE) | ||
@if [ $(LATEST) = "true" ]; \ | ||
then\ | ||
docker tag $(IMAGE) $(LATEST_IMAGE); \ | ||
docker push $(LATEST_IMAGE); \ | ||
fi | ||
|
||
clean: | ||
rm -rf src |
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 @@ | ||
src |
43 changes: 43 additions & 0 deletions
43
longhornio/longhorn-manager/1.6.2/0001-port-to-loong64.patch
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,43 @@ | ||
diff --git a/Makefile b/Makefile | ||
index 78839b9..2200d04 100644 | ||
--- a/Makefile | ||
+++ b/Makefile | ||
@@ -2,7 +2,8 @@ TARGETS := $(shell ls scripts) | ||
|
||
.dapper: | ||
@echo Downloading dapper | ||
- @curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m` > .dapper.tmp | ||
+# @curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m` > .dapper.tmp | ||
+ @curl -sL https://github.com/Loongson-Cloud-Community/dapper/releases/download/v0.6.0/dapper-Linux-loongarch64 > .dapper.tmp | ||
@@chmod +x .dapper.tmp | ||
@./.dapper.tmp -v | ||
@mv .dapper.tmp .dapper | ||
diff --git a/package/Dockerfile b/package/Dockerfile | ||
index 53a7649..3573173 100644 | ||
--- a/package/Dockerfile | ||
+++ b/package/Dockerfile | ||
@@ -1,7 +1,6 @@ | ||
-FROM registry.suse.com/bci/bci-base:15.5 | ||
+FROM cr.loongnix.cn/openanolis/anolisos:8.9 | ||
|
||
-RUN zypper -n install iputils iproute2 nfs-client cifs-utils bind-utils e2fsprogs xfsprogs zip unzip && \ | ||
- rm -rf /var/cache/zypp/* | ||
+RUN yum install -y iputils iproute nfs-utils cifs-utils bind-utils e2fsprogs xfsprogs zip unzip | ||
|
||
COPY bin package/launch-manager package/nsmounter /usr/local/sbin/ | ||
|
||
diff --git a/scripts/package b/scripts/package | ||
index f276177..475e420 100755 | ||
--- a/scripts/package | ||
+++ b/scripts/package | ||
@@ -10,8 +10,8 @@ SUFFIX="" | ||
[ "${ARCH}" != "amd64" ] && SUFFIX="_${ARCH}" | ||
|
||
TAG=${TAG:-${IMAGE_TAG_PREFIX}${SUFFIX}} | ||
-REPO=${REPO:-longhornio} | ||
-IMAGE=${IMAGE:-${REPO}/longhorn-manager:${TAG}} | ||
+REPO=${REPO:-cr.loongnix.cn/longhornio} | ||
+IMAGE=${IMAGE:-${REPO}/longhorn-manager:1.6.2} | ||
|
||
if [ ! -e ./bin/longhorn-manager ]; then | ||
./scripts/build |
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?=cr.loongnix.cn | ||
ORGANIZATION?=longhornio | ||
REPOSITORY?=longhorn-manager | ||
TAG?=1.6.2 | ||
LATEST?=true | ||
|
||
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/longhorn/longhorn-manager | ||
SOURCE=$(shell echo $(SOURCE_URL) | awk -F '/' '{print $$NF}' | awk -F '.' '{print $$1}') | ||
PATCH=0001-port-to-loong64.patch | ||
|
||
default: image | ||
|
||
image: src/$(SOURCE) | ||
# Commands for building. | ||
cd src/$(SOURCE) && bash scripts/package | ||
|
||
src/$(SOURCE): | ||
git clone -q -b v$(TAG) --depth=1 $(SOURCE_URL) $@ | ||
cd $@ && \ | ||
git apply ../../$(PATCH) | ||
|
||
push: | ||
docker push $(IMAGE) | ||
@if [ $(LATEST) = "true" ]; \ | ||
then\ | ||
docker tag $(IMAGE) $(LATEST_IMAGE); \ | ||
docker push $(LATEST_IMAGE); \ | ||
fi | ||
|
||
clean: | ||
rm -rf src |
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