Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/qiangxuhui/dockerfiles into…
Browse files Browse the repository at this point in the history
… main
  • Loading branch information
qiangxuhui committed Jul 15, 2024
2 parents 9f283f6 + a5c6558 commit acf477a
Show file tree
Hide file tree
Showing 7 changed files with 222 additions and 4 deletions.
82 changes: 82 additions & 0 deletions kubernetes/etcd/3.5.14/0001-support-loong64.patch
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

52 changes: 52 additions & 0 deletions kubernetes/etcd/3.5.14/Makefile
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
1 change: 1 addition & 0 deletions longhornio/longhorn-manager/1.6.2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src
43 changes: 43 additions & 0 deletions longhornio/longhorn-manager/1.6.2/0001-port-to-loong64.patch
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
40 changes: 40 additions & 0 deletions longhornio/longhorn-manager/1.6.2/Makefile
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
4 changes: 2 additions & 2 deletions minio/minio/debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM cr.loongnix.cn/library/golang:1.21-buster AS builder-mc
ARG TARGETARCH
ARG MC_VERSION=RELEASE.2024-05-03T11-21-07Z
ARG MC_VERSION=RELEASE.2024-07-03T20-17-25Z

WORKDIR /opt
RUN set -ex \
Expand All @@ -14,7 +14,7 @@ RUN set -ex \

FROM cr.loongnix.cn/library/golang:1.21-buster AS build
ARG TARGETARCH
ARG MINIO_VERSION=RELEASE.2024-05-07T06-41-25Z
ARG MINIO_VERSION=RELEASE.2024-07-04T14-25-45Z

WORKDIR /opt
RUN set -ex \
Expand Down
4 changes: 2 additions & 2 deletions minio/minio/debian/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ REGISTRY?=cr.loongnix.cn
ORGANIZATION?=minio
REPOSITORY?=minio

MINIO_VERSION?=RELEASE.2024-05-07T06-41-25Z
MC_VERSION?=RELEASE.2024-05-03T11-21-07Z
MINIO_VERSION?=RELEASE.2024-07-04T14-25-45Z
MC_VERSION?=RELEASE.2024-07-03T20-17-25Z
TAG?=$(MINIO_VERSION)

IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG)
Expand Down

0 comments on commit acf477a

Please sign in to comment.