diff --git a/portainer/portainer/2.11.1/0001-add-loong64-support.patch b/portainer/portainer/2.11.1/0001-add-loong64-support-abi-2.0.patch similarity index 80% rename from portainer/portainer/2.11.1/0001-add-loong64-support.patch rename to portainer/portainer/2.11.1/0001-add-loong64-support-abi-2.0.patch index 7cf166b..0035c13 100644 --- a/portainer/portainer/2.11.1/0001-add-loong64-support.patch +++ b/portainer/portainer/2.11.1/0001-add-loong64-support-abi-2.0.patch @@ -1,16 +1,18 @@ -From be26de17e2e18b5d84b61b0e237702a6d3df3d7e Mon Sep 17 00:00:00 2001 +From 718e9ccdbb3e76471f14f2fc03e5eba9b70a7552 Mon Sep 17 00:00:00 2001 From: yzewei -Date: Mon, 20 May 2024 15:37:30 +0800 -Subject: [PATCH] add loong64 support +Date: Tue, 21 May 2024 10:48:47 +0800 +Subject: [PATCH] add loong64 support (abi-2.0) Signed-off-by: yzewei --- - api/database/boltdb/db.go | 2 +- - api/database/boltdb/export.go | 2 +- - api/go.mod | 10 +++++----- - api/go.sum | 21 ++++++++++++++------- - build/linux/alpine.Dockerfile | 2 +- - 5 files changed, 22 insertions(+), 15 deletions(-) + api/database/boltdb/db.go | 2 +- + api/database/boltdb/export.go | 2 +- + api/go.mod | 10 +++++----- + api/go.sum | 21 ++++++++++++++------- + build/download_docker_compose_binary.sh | 14 ++++++++++---- + build/linux/Dockerfile | 4 +++- + build/linux/alpine.Dockerfile | 5 +++-- + 7 files changed, 37 insertions(+), 21 deletions(-) diff --git a/api/database/boltdb/db.go b/api/database/boltdb/db.go index 8ffe14b..e35a8a1 100644 @@ -152,8 +154,51 @@ index b04a82a..844d282 100644 gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= +diff --git a/build/download_docker_compose_binary.sh b/build/download_docker_compose_binary.sh +index 63ea5b0..a3181db 100755 +--- a/build/download_docker_compose_binary.sh ++++ b/build/download_docker_compose_binary.sh +@@ -45,13 +45,19 @@ function download_plugin() { + FILENAME="$FILENAME.exe" + TARGET_FILENAME="$TARGET_FILENAME.exe" + fi +- +- wget -O "dist/$TARGET_FILENAME" "https://github.com/docker/compose-cli/releases/download/v$PLUGIN_VERSION/$FILENAME" +- chmod +x "dist/$TARGET_FILENAME" ++ ++ if [[ "$PLATFORM" == "loong64" ]]; then ++ URL="http://cloud.loongnix.cn/releases/loongarch64/docker/compose/2.22.0/docker-compose-loong64-v2.22.0-rc.1.tar.gz" ++ wget -O "dist/$TARGET_FILENAME" $URL ++ chmod +x "dist/$TARGET_FILENAME" ++ fi ++ ++# wget -O "dist/$TARGET_FILENAME" "https://github.com/docker/compose-cli/releases/download/v$PLUGIN_VERSION/$FILENAME" ++# chmod +x "dist/$TARGET_FILENAME" + } + + if [ "${PLATFORM}" == 'linux' ] && [ "${ARCH}" != 'amd64' ]; then + download_plugin "$PLATFORM" "$ARCH" "$DOCKER_COMPOSE_VERSION" + fi + +-download_binary "$PLATFORM" "$ARCH" "$DOCKER_COMPOSE_VERSION" +\ No newline at end of file ++download_binary "$PLATFORM" "$ARCH" "$DOCKER_COMPOSE_VERSION" +diff --git a/build/linux/Dockerfile b/build/linux/Dockerfile +index c07dc6d..bec8ef7 100644 +--- a/build/linux/Dockerfile ++++ b/build/linux/Dockerfile +@@ -1,6 +1,8 @@ +-FROM portainer/base ++FROM lcr.loongnix.cn/portainer/base:latest + + COPY dist / ++COPY public /public ++COPY storybook /storybook + + VOLUME /data + WORKDIR / diff --git a/build/linux/alpine.Dockerfile b/build/linux/alpine.Dockerfile -index 6108c4c..2c0abf7 100644 +index 6108c4c..053c11d 100644 --- a/build/linux/alpine.Dockerfile +++ b/build/linux/alpine.Dockerfile @@ -1,4 +1,4 @@ @@ -162,6 +207,13 @@ index 6108c4c..2c0abf7 100644 COPY dist / +@@ -9,4 +9,5 @@ EXPOSE 9000 + EXPOSE 9443 + EXPOSE 8000 + +-ENTRYPOINT ["/portainer"] ++#ENTRYPOINT ["/portainer"] ++ENTRYPOINT ["/bin/sh"] -- 2.41.0 diff --git a/portainer/portainer/2.11.1/Makefile b/portainer/portainer/2.11.1/Makefile index f1800c4..09a99b1 100644 --- a/portainer/portainer/2.11.1/Makefile +++ b/portainer/portainer/2.11.1/Makefile @@ -6,27 +6,36 @@ REPOSITORY ?=portainer TAG ?=2.11.1 LATEST ?=true -IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG) -LATEST_IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):latest +IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY)-ce:$(TAG) +LATEST_IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY)-ce:latest URL=https://github.com/portainer/portainer -PATCH=0001-add-loong64-support.patch +PATCH=0001-add-loong64-support-abi-2.0.patch default: image src: clean + wget https://github.com/Loongson-Cloud-Community/portainer/releases/download/2.11.1/portainer-fronted.tar.gz && tar xf portainer-fronted.tar.gz && rm portainer-fronted.tar.gz && \ git clone -b 2.11.1 --depth 1 $(URL) && \ - cd $(REPOSITORY) && \ - git apply ../0001-add-loong64-support.patch && cd api && go mod vendor + cd $(REPOSITORY) && \ + git apply ../$(PATCH) && cd api && go mod vendor cd $(REPOSITORY) && bash build/build_binary.sh linux loong64 -image: - cd $(REPOSITORY) && docker build \ +download: src + mkdir -p dist && cd dist && \ + wget -O kubectl http://cloud.loongnix.cn/releases/loongarch64/kubernetes/kubernetes/v1.20.0/kubectl && chmod +x kubectl && \ + wget http://cloud.loongnix.cn/releases/loongarch64/docker/cli/24.0.6/cli-loong64-24.0.6.tar.gz && tar xf cli-loong64-24.0.6.tar.gz && cp build/* ./ && rm -rf build cli-loong64-24.0.6.tar.gz && \ + wget http://cloud.loongnix.cn/releases/loongarch64/docker/compose/2.22.0/docker-compose-loong64-v2.22.0-rc.1.tar.gz && tar xf docker-compose-loong64-v2.22.0-rc.1.tar.gz && cp docker-compose-loong64-v2.22.0-rc.1/* ./ && rm -rf docker-compose-loong64-v2.22.0-rc.1 docker-compose-loong64-v2.22.0-rc.1.tar.gz && \ + cp ../portainer/dist/portainer ./ +image: download + docker build -t lcr.loongnix.cn/portainer/base:latest -f base.Dockerfile . + docker build \ --build-arg http_proxy=$(http_proxy) \ --build-arg https_proxy=$(https_proxy) \ - -t $(IMAGE) -f build/linux/alpine.Dockerfile \ + -t $(IMAGE) -f portainer/build/linux/Dockerfile \ . push: docker push $(IMAGE) + docker push lcr.loongnix.cn/portainer/base:latest #latest image @if [ $(LATEST) = "true" ]; \ then \ @@ -35,4 +44,4 @@ push: fi clean: - rm -rf $(REPOSITORY) + rm -rf $(REPOSITORY) public storybook dist diff --git a/portainer/portainer/2.11.1/base.Dockerfile b/portainer/portainer/2.11.1/base.Dockerfile new file mode 100644 index 0000000..043d9d7 --- /dev/null +++ b/portainer/portainer/2.11.1/base.Dockerfile @@ -0,0 +1,7 @@ +FROM lcr.loongnix.cn/library/alpine:3.19 as base +RUN apk --no-cache --update upgrade && apk --no-cache add ca-certificates +RUN mkdir /buildtmp + +FROM scratch +COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt +COPY --from=base /buildtmp /tmp diff --git a/portainer/portainer/2.11.1/docker-compose.yml b/portainer/portainer/2.11.1/docker-compose.yml index dfdf061..b3201cb 100644 --- a/portainer/portainer/2.11.1/docker-compose.yml +++ b/portainer/portainer/2.11.1/docker-compose.yml @@ -1,7 +1,10 @@ -version: '3' +version: '2' services: - portainer: - image: portainer:latest + portainer-prod: + # image: portainer:latest + #image: portainer/update:latest + image: lcr.loongnix.cn/portainer/portainer:2.11.1 + container_name: portainer-prod ports: - "9000:9000" volumes: