Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ OUTPUT_DIR = $(ROOT_DIR)/_output
BIN_DIR = $(OUTPUT_DIR)/bin
REPO_PREFIX = yunion.io/x/kubecomps

HELM_VERSION ?= v4.0.0-1

REGISTRY ?= "registry.cn-beijing.aliyuncs.com/yunionio"
VERSION ?= $(shell git describe --exact-match 2> /dev/null || \
git describe --match=$(git rev-parse --short=8 HEAD) --always --dirty --abbrev=8)
Expand Down Expand Up @@ -38,7 +40,7 @@ build: clean generate
done

embed-helm-pkgs:
docker run --rm -v $(shell pwd):/app registry.cn-beijing.aliyuncs.com/yunionio/helm:v3.5.2 \
docker run --rm -v $(shell pwd):/app registry.cn-beijing.aliyuncs.com/yunionio/helm:$(HELM_VERSION) \
/bin/bash -c "cd /app && /app/scripts/embed-helm-pkgs.sh"

generate: embed-helm-pkgs
Expand Down
11 changes: 7 additions & 4 deletions build/docker/Dockerfile.helm
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
FROM alpine:3
FROM alpine:3.22.2

RUN sed -i 's!https://dl-cdn.alpinelinux.org/!https://mirrors.ustc.edu.cn/!g' /etc/apk/repositories
ARG TARGETARCH

# variable "VERSION" must be passed as docker environment variables during the image build
# docker build --no-cache -t registry.cn-beijing.aliyuncs.com/yunionio/helm:v3.5.2 .

# ENV BASE_URL="https://storage.googleapis.com/kubernetes-helm"
ENV BASE_URL="https://get.helm.sh"
ENV TAR_FILE="helm-v3.5.2-linux-amd64.tar.gz"
ENV TAR_FILE="helm-v4.0.0-linux-${TARGETARCH}.tar.gz"

RUN apk add --update --no-cache bash curl ca-certificates && \
curl -L ${BASE_URL}/${TAR_FILE} |tar xvz && \
mv linux-amd64/helm /usr/bin/helm && \
mv linux-${TARGETARCH}/helm /usr/bin/helm && \
chmod +x /usr/bin/helm && \
rm -rf linux-amd64 && \
rm -rf linux-${TARGETARCH} && \
apk del curl && \
rm -f /var/cache/apk/*
2 changes: 1 addition & 1 deletion build/docker/Dockerfile.kube-build
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:3.19.0-go-1.21.10-0
FROM registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:3.22.2-go-1.24.9-0

RUN apk add librados librbd
2 changes: 1 addition & 1 deletion build/docker/Dockerfile.kubectl-1_20
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:3.16.0-go-1.18.2-0
FROM registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:3.22.2-go-1.24.9-0

RUN sed -i 's!https://dl-cdn.alpinelinux.org/!https://mirrors.ustc.edu.cn/!g' /etc/apk/repositories
RUN apk update \
Expand Down
4 changes: 2 additions & 2 deletions build/docker/Dockerfile.kubeserver-base-1_20
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/kubectl:1.24.3
FROM registry.cn-beijing.aliyuncs.com/yunionio/kubectl:1.24.3-1
RUN mkdir -p /opt/yunion/bin
RUN apk add --no-cache librados librbd \
openssh-client py-netaddr tzdata rsync \
git ca-certificates py3-pip python3-dev build-base libffi-dev openssl-dev skopeo aws-cli \
&& rm -rf /var/cache/apk/*
RUN pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple ansible==3.4.0
RUN pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple ansible==3.4.0 --break-system-packages
4 changes: 2 additions & 2 deletions build/docker/Dockerfile.kubeserver-mularch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/kube-build:3.19.0-go-1.21.10-0 as build
FROM registry.cn-beijing.aliyuncs.com/yunionio/kube-build:3.22.2-go-1.24.9-0 AS build
ARG TARGETPLATFORM
ARG BUILDPLATFORM
RUN mkdir -p /go/src/yunion.io/x/kubecomps
Expand All @@ -7,7 +7,7 @@ COPY . /go/src/yunion.io/x/kubecomps
WORKDIR /go/src/yunion.io/x/kubecomps
RUN make cmd/kubeserver

FROM registry.cn-beijing.aliyuncs.com/yunionio/kubeserver-base:20230803.0
FROM registry.cn-beijing.aliyuncs.com/yunionio/kubeserver-base:20251118.0
RUN mkdir -p /opt/yunion/bin
COPY --from=build /go/src/yunion.io/x/kubecomps/manifests/ansible /opt/yunion/ansible
COPY --from=build /go/src/yunion.io/x/kubecomps/_output/bin/kubeserver /opt/yunion/bin/kubeserver
Expand Down
19 changes: 11 additions & 8 deletions build/docker/Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
REGISTRY ?= registry.cn-beijing.aliyuncs.com/yunionio
DOCKER_BUILD = docker build -t $(REGISTRY)
DOCKER_BUILDX = docker buildx build --platform linux/arm64,linux/amd64 --push -t $(REGISTRY)
platforms = linux/arm64,linux/amd64,linux/riscv64
DOCKER_BUILDX = docker buildx build --platform $(platforms) --push -t $(REGISTRY)
KUBE_BUILD_VERSION = 3.22.2-go-1.24.9-0
HELM_VERSION = v4.0.0-1

helm:
docker build -f ./Dockerfile.helm -t registry.cn-beijing.aliyuncs.com/yunionio/helm:v3.5.2 .

kube-build-img?=registry.cn-beijing.aliyuncs.com/yunionio/kube-build:3.19.0-go-1.21.10-0
$(DOCKER_BUILDX)/helm:$(HELM_VERSION) -f ./Dockerfile.helm .
docker pull $(REGISTRY)/helm:$(HELM_VERSION)

kube-build:
docker buildx build --platform linux/arm64,linux/amd64 -f ./Dockerfile.kube-build -t $(kube-build-img) . --push
docker pull $(kube-build-img)
$(DOCKER_BUILDX)/kube-build:$(KUBE_BUILD_VERSION) -f ./Dockerfile.kube-build .
docker pull $(REGISTRY)/kube-build:$(KUBE_BUILD_VERSION)s

KUBECTL_VERSION = 1.24.3
KUBECTL_VERSION = 1.24.3-1
kubectl:
$(DOCKER_BUILDX)/kubectl:$(KUBECTL_VERSION) -f ./Dockerfile.kubectl-1_20 .
docker pull $(REGISTRY)/kubectl:$(KUBECTL_VERSION)

KUBESERVER_BASE_VERSION = 20230803.0
KUBESERVER_BASE_VERSION = 20251118.0
kubeserver-base:
$(DOCKER_BUILDX)/kubeserver-base:$(KUBESERVER_BASE_VERSION) -f ./Dockerfile.kubeserver-base-1_20 .
16 changes: 13 additions & 3 deletions scripts/docker_push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ get_current_arch() {
aarch64)
current_arch=arm64
;;
riscv64)
current_arch=riscv64
;;
esac
echo $current_arch
}
Expand Down Expand Up @@ -64,7 +67,7 @@ build_bin() {
-v $SRC_DIR:/root/go/src/yunion.io/x/kubecomps \
-v $SRC_DIR/_output/alpine-build:/root/go/src/yunion.io/x/kubecomps/_output \
-v $SRC_DIR/_output/alpine-build/_cache:/root/.cache \
registry.cn-beijing.aliyuncs.com/yunionio/kube-build:3.16.0-go-1.18.2-0 \
registry.cn-beijing.aliyuncs.com/yunionio/kube-build:3.22.2-go-1.24.9-0 \
/bin/sh -c "set -ex; cd /root/go/src/yunion.io/x/kubecomps; $BUILD_ARCH $BUILD_CGO GOOS=linux make cmd/$1; chown -R $(id -u):$(id -g) _output"
;;
esac
Expand All @@ -85,6 +88,9 @@ build_image() {
aarch64)
docker buildx build -t "$tag" -f "$2" "$3" --output type=docker --platform linux/arm64
;;
riscv64)
docker buildx build -t "$tag" -f "$2" "$3" --output type=docker --platform linux/riscv64
;;
*)
echo wrong arch
exit 1
Expand All @@ -95,6 +101,8 @@ build_image() {
docker buildx build -t "$tag" -f "$file" "$path" --push --platform linux/amd64
elif [[ "$tag" == *"arm64" || "$ARCH" == "arm64" ]]; then
docker buildx build -t "$tag" -f "$file" "$path" --push --platform linux/arm64
elif [[ "$tag" == *"riscv" || "$ARCH" == "riscv64" ]]; then
docker buildx build -t "$tag" -f "$file" "$path" --push --platform linux/riscv64
else
docker buildx build -t "$tag" -f "$file" "$path" --push
fi
Expand All @@ -120,7 +128,7 @@ get_image_name() {
local arch=$2
local is_all_arch=$3
local img_name="$REGISTRY/$component:$TAG"
if [[ "$is_all_arch" == "true" || "$arch" == arm64 ]]; then
if [[ "$is_all_arch" == "true" || "$arch" == arm64 || "$arch" == riscv64 ]]; then
img_name="${img_name}-$arch"
fi
echo $img_name
Expand Down Expand Up @@ -179,9 +187,11 @@ make_manifest_image() {

docker buildx imagetools create -t $img_name \
$img_name-amd64 \
$img_name-riscv64 \
$img_name-arm64
docker manifest inspect ${img_name} | grep -wq amd64
docker manifest inspect ${img_name} | grep -wq arm64
docker manifest inspect ${img_name} | grep -wq riscv64
}

ALL_COMPONENTS=$(ls cmd | grep -v '.*cli$' | xargs)
Expand Down Expand Up @@ -210,7 +220,7 @@ for component in $COMPONENTS; do

case "$ARCH" in
all)
for arch in "arm64" "amd64"; do
for arch in "arm64" "amd64" "riscv64"; do
general_build $component $arch "true"
done
make_manifest_image $component
Expand Down
Loading