Skip to content

Commit

Permalink
add longhornio/longhorn-engine/1.6.2
Browse files Browse the repository at this point in the history
Signed-off-by: yzewei <[email protected]>
  • Loading branch information
yzewei committed Jul 15, 2024
1 parent a5c6558 commit cd1ff1c
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 1 deletion.
107 changes: 107 additions & 0 deletions longhornio/longhorn-engine/1.6.2/0001-port-to-loong64.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
diff --git a/package/Dockerfile b/package/Dockerfile
index 7d9dd93..d32e88a 100644
--- a/package/Dockerfile
+++ b/package/Dockerfile
@@ -1,17 +1,14 @@
-FROM registry.suse.com/bci/bci-base:15.5 AS builder
+FROM cr.loongnix.cn/openanolis/anolisos:8.9 AS builder

-ARG ARCH=amd64
-
-RUN zypper -n addrepo --refresh https://download.opensuse.org/repositories/system:/snappy/SLE_15/system:snappy.repo && \
- zypper -n addrepo --refresh https://download.opensuse.org/repositories/network:/utilities/SLE_15_SP5/network:utilities.repo && \
- zypper --gpg-auto-import-keys ref
+ARG ARCH=loongarch64

-RUN zypper -n install cmake curl git gcc wget xsltproc docbook-xsl-stylesheets && \
- rm -rf /var/cache/zypp/*
+#RUN yum install -y cmake curl git gcc wget xsltproc docbook-xsl-stylesheets
+RUN yum install -y cmake curl git gcc wget libxslt-devel docbook-style-xsl

# Build liblonghorn
ENV LIBLONGHORN_COMMIT_ID 53d1c063b95efc8d949b095bd4bf04637230265f
-RUN cd /usr/src && \
+RUN mkdir -p /usr/src && \
+ cd /usr/src && \
git clone https://github.com/rancher/liblonghorn.git && \
cd liblonghorn && \
git checkout ${LIBLONGHORN_COMMIT_ID} && \
@@ -28,20 +25,16 @@ RUN cd /usr/src && \
make install

# Install grpc_health_probe
-RUN wget https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v0.4.24/grpc_health_probe-linux-${ARCH} -O /usr/local/bin/grpc_health_probe && \
+RUN wget https://github.com/Loongson-Cloud-Community/grpc-health-probe/releases/download/v0.4.24/grpc_health_probe-linux-loongarch64 -O /usr/local/bin/grpc_health_probe && \
chmod +x /usr/local/bin/grpc_health_probe

-FROM registry.suse.com/bci/bci-base:15.5 AS release
+FROM cr.loongnix.cn/openanolis/anolisos:8.9 AS release

ARG ARCH=amd64

-RUN zypper -n addrepo --refresh https://download.opensuse.org/repositories/system:/snappy/SLE_15/system:snappy.repo && \
- zypper -n addrepo --refresh https://download.opensuse.org/repositories/network:/utilities/SLE_15_SP5/network:utilities.repo && \
- zypper --gpg-auto-import-keys ref

-RUN zypper -n install nfs-client nfs4-acl-tools cifs-utils libaio1 sg3_utils \
- iputils iproute2 qemu-tools e2fsprogs && \
- rm -rf /var/cache/zypp/*
+RUN yum install -y nfs-utils nfs4-acl-tools cifs-utils libaio-devel sg3_utils \
+ iputils iproute qemu-kvm e2fsprogs

# Copy pre-built binaries from builder
COPY --from=builder \
@@ -61,7 +54,8 @@ VOLUME /usr/local/bin

# Add Tini
ENV TINI_VERSION v0.19.0
-ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${ARCH} /tini
+#ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${ARCH} /tini
+ADD https://github.com/Loongson-Cloud-Community/tini/releases/download/v0.19.0/tini-static /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]

diff --git a/scripts/build b/scripts/build
index 21106ff..4d02565 100755
--- a/scripts/build
+++ b/scripts/build
@@ -20,3 +20,4 @@ cd $(dirname $0)/..

mkdir -p bin
go build -o bin/longhorn -tags netgo -ldflags "$LINKFLAGS" $COVER $COVERPKG
+#go build -o bin/longhorn -ldflags "$LINKFLAGS" $COVER $COVERPKG
diff --git a/scripts/package b/scripts/package
index ec3d882..6a0e83b 100755
--- a/scripts/package
+++ b/scripts/package
@@ -8,8 +8,8 @@ cd $(dirname $0)/..
PROJECT=`basename "$PWD"`

TAG=${TAG:-${VERSION}}
-REPO=${REPO:-longhornio}
-IMAGE=${REPO}/${PROJECT}:${TAG}
+REPO=${REPO:-cr.loongnix.cn/longhornio}
+IMAGE=${REPO}/${PROJECT}:1.6.2

case $(uname -m) in
aarch64 | arm64)
@@ -20,6 +20,9 @@ case $(uname -m) in
;;
s390x)
ARCH=s390x
+ ;;
+ loongarch64)
+ ARCH=loong64
;;
*)
echo "$(uname -a): unsupported architecture"
@@ -30,7 +33,8 @@ if [ ! -x ./bin/longhorn ]; then
./scripts/build
fi

-cp /usr/local/bin/longhorn-instance-manager ./bin/
+wget https://github.com/Loongson-Cloud-Community/longhorn-instance-manager/releases/download/v1.6.2/longhorn-instance-manager -O ./bin/longhorn-instance-manager
+#cp /usr/local/bin/longhorn-instance-manager ./bin/

# update base image to get latest changes
grep FROM package/Dockerfile | awk '{print $2}' | while read -r BASE_IMAGE
40 changes: 40 additions & 0 deletions longhornio/longhorn-engine/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-engine
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/$(ORGANIZATION)/$(REPOSITORY)
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.
bash scripts/package

src/$(SOURCE):
git clone -q -b $(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
2 changes: 1 addition & 1 deletion longhornio/longhorn-manager/1.6.2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ REGISTRY?=cr.loongnix.cn
ORGANIZATION?=longhornio
REPOSITORY?=longhorn-manager
TAG?=1.6.2
LATEST?=true
LATEST?=false

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

0 comments on commit cd1ff1c

Please sign in to comment.