Skip to content

Commit

Permalink
Add docker buildx build to the Makefile to build and push multi-arch …
Browse files Browse the repository at this point in the history
…docker images

Signed-off-by: odidev <[email protected]>
  • Loading branch information
odidev committed Jun 14, 2022
1 parent aea8dd5 commit d20794e
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 20 deletions.
38 changes: 38 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ DOCKER_PUSH += docker-push-goosefsruntime-controller
DOCKER_PUSH += docker-push-juicefsruntime-controller
DOCKER_PUSH += docker-push-init-users

# Buildx docker images
DOCKER_BUILDX := docker-buildx-dataset-controller
DOCKER_BUILDX += docker-buildx-application-controller
DOCKER_BUILDX += docker-buildx-alluxioruntime-controller
DOCKER_BUILDX += docker-buildx-jindoruntime-controller
DOCKER_BUILDX += docker-buildx-goosefsruntime-controller
DOCKER_BUILDX += docker-buildx-csi
DOCKER_BUILDX += docker-buildx-webhook
DOCKER_BUILDX += docker-buildx-juicefsruntime-controller
DOCKER_BUILDX += docker-buildx-init-users

override LDFLAGS += \
-X ${PACKAGE}.version=${VERSION} \
-X ${PACKAGE}.buildDate=${BUILD_DATE} \
Expand Down Expand Up @@ -225,10 +236,37 @@ docker-push-init-users: docker-build-init-users
docker-push-webhook: docker-build-webhook
docker push ${WEBHOOK_IMG}:${GIT_VERSION}

# Buildx the docker image
docker-buildx-dataset-controller: generate gen-openapi fmt vet
docker buildx build --push --platform linux/amd64,linux/arm64 --no-cache . -f docker/Dockerfile.dataset -t ${DATASET_CONTROLLER_IMG}:${GIT_VERSION}

docker-buildx-application-controller: generate fmt vet
docker buildx build --push --platform linux/amd64,linux/arm64 --no-cache . -f docker/Dockerfile.application -t ${APPLICATION_CONTROLLER_IMG}:${GIT_VERSION}

docker-buildx-alluxioruntime-controller: generate gen-openapi fmt vet
docker buildx build --push --platform linux/amd64,linux/arm64 --no-cache . -f docker/Dockerfile.alluxioruntime -t ${ALLUXIORUNTIME_CONTROLLER_IMG}:${GIT_VERSION}

docker-buildx-jindoruntime-controller: generate gen-openapi fmt vet
docker buildx build --push --platform linux/amd64,linux/arm64 --no-cache . -f docker/Dockerfile.jindoruntime -t ${JINDORUNTIME_CONTROLLER_IMG}:${GIT_VERSION}

docker-buildx-goosefsruntime-controller: generate gen-openapi fmt vet
docker buildx build --push --platform linux/amd64,linux/arm64 --no-cache . -f docker/Dockerfile.goosefsruntime -t ${GOOSEFSRUNTIME_CONTROLLER_IMG}:${GIT_VERSION}

docker-buildx-juicefsruntime-controller: generate gen-openapi fmt vet juicefsruntime-controller-build
docker buildx build --push --platform linux/amd64,linux/arm64 --no-cache . -f docker/Dockerfile.juicefsruntime -t ${JUICEFSRUNTIME_CONTROLLER_IMG}:${GIT_VERSION}

docker-buildx-csi: generate fmt vet
docker buildx build --push --platform linux/amd64,linux/arm64 --no-cache . -f docker/Dockerfile.csi -t ${CSI_IMG}:${GIT_VERSION}

docker-buildx-init-users:
docker buildx build --push --platform linux/amd64,linux/arm64 --no-cache charts/alluxio/docker/init-users -t ${INIT_USERS_IMG}:${GIT_VERSION}

docker-buildx-webhook:
docker buildx build --push --platform linux/amd64,linux/arm64 --no-cache . -f docker/Dockerfile.webhook -t ${WEBHOOK_IMG}:${GIT_VERSION}

docker-build-all: ${DOCKER_BUILD}
docker-push-all: ${DOCKER_PUSH}
docker-buildx-all: ${DOCKER_BUILDX}

gen-sdk:
./hack/sdk/gen-sdk.sh
Expand Down
11 changes: 8 additions & 3 deletions docker/Dockerfile.alluxioruntime
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@ RUN apk add --update curl tzdata iproute2 bash libc6-compat vim && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone

RUN curl -o helm-v3.0.3-linux-amd64.tar.gz http://aliacs-k8s-cn-hongkong.oss-cn-hongkong.aliyuncs.com/public/pkg/helm/helm-v3.0.3-linux-amd64.tar.gz && \
RUN if [ `uname -m` == "aarch64" ] ; then curl -o helm-v3.0.3-linux-arm64.tar.gz https://get.helm.sh/helm-v3.7.2-linux-arm64.tar.gz && \
tar -xvf helm-v3.0.3-linux-arm64.tar.gz && \
mv linux-arm64/helm /usr/local/bin/ddc-helm && \
chmod u+x /usr/local/bin/ddc-helm && \
rm -f helm-v3.0.3-linux-arm64.tar.gz; else curl -o helm-v3.0.3-linux-amd64.tar.gz http://aliacs-k8s-cn-hongkong.oss-cn-hongkong.aliyuncs.com/public/pkg/helm/helm-v3.0.3-linux-amd64.tar.gz && \
tar -xvf helm-v3.0.3-linux-amd64.tar.gz && \
mv linux-amd64/helm /usr/local/bin/ddc-helm && \
chmod u+x /usr/local/bin/ddc-helm && \
rm -f helm-v3.0.3-linux-amd64.tar.gz
rm -f helm-v3.0.3-linux-amd64.tar.gz; fi

ENV K8S_VERSION v1.14.8
RUN curl -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl && chmod +x /usr/local/bin/kubectl
RUN if [ `uname -m` == "aarch64" ] ; then ARCH="arm64"; else ARCH="amd64"; fi
RUN curl -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/${ARCH}/kubectl && chmod +x /usr/local/bin/kubectl

ADD charts/ /charts

Expand Down
11 changes: 8 additions & 3 deletions docker/Dockerfile.application
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@ RUN apk add --update curl tzdata iproute2 bash libc6-compat vim && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone

RUN curl -o helm-v3.0.3-linux-amd64.tar.gz http://aliacs-k8s-cn-hongkong.oss-cn-hongkong.aliyuncs.com/public/pkg/helm/helm-v3.0.3-linux-amd64.tar.gz && \
RUN if [ `uname -m` == "aarch64" ] ; then curl -o helm-v3.0.3-linux-arm64.tar.gz https://get.helm.sh/helm-v3.7.2-linux-arm64.tar.gz && \
tar -xvf helm-v3.0.3-linux-arm64.tar.gz && \
mv linux-arm64/helm /usr/local/bin/ddc-helm && \
chmod u+x /usr/local/bin/ddc-helm && \
rm -f helm-v3.0.3-linux-arm64.tar.gz; else curl -o helm-v3.0.3-linux-amd64.tar.gz http://aliacs-k8s-cn-hongkong.oss-cn-hongkong.aliyuncs.com/public/pkg/helm/helm-v3.0.3-linux-amd64.tar.gz && \
tar -xvf helm-v3.0.3-linux-amd64.tar.gz && \
mv linux-amd64/helm /usr/local/bin/ddc-helm && \
chmod u+x /usr/local/bin/ddc-helm && \
rm -f helm-v3.0.3-linux-amd64.tar.gz
rm -f helm-v3.0.3-linux-amd64.tar.gz; fi

ENV K8S_VERSION v1.14.8
RUN curl -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl && chmod +x /usr/local/bin/kubectl
RUN if [ `uname -m` == "aarch64" ] ; then ARCH="arm64"; else ARCH="amd64"; fi
RUN curl -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/${ARCH}/kubectl && chmod +x /usr/local/bin/kubectl

ADD charts/ /charts

Expand Down
11 changes: 8 additions & 3 deletions docker/Dockerfile.dataset
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@ RUN apk add --update curl tzdata iproute2 bash libc6-compat vim && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone

RUN curl -o helm-v3.0.3-linux-amd64.tar.gz http://aliacs-k8s-cn-hongkong.oss-cn-hongkong.aliyuncs.com/public/pkg/helm/helm-v3.0.3-linux-amd64.tar.gz && \
RUN if [ `uname -m` == "aarch64" ] ; then curl -o helm-v3.0.3-linux-arm64.tar.gz https://get.helm.sh/helm-v3.7.2-linux-arm64.tar.gz && \
tar -xvf helm-v3.0.3-linux-arm64.tar.gz && \
mv linux-arm64/helm /usr/local/bin/ddc-helm && \
chmod u+x /usr/local/bin/ddc-helm && \
rm -f helm-v3.0.3-linux-arm64.tar.gz; else curl -o helm-v3.0.3-linux-amd64.tar.gz http://aliacs-k8s-cn-hongkong.oss-cn-hongkong.aliyuncs.com/public/pkg/helm/helm-v3.0.3-linux-amd64.tar.gz && \
tar -xvf helm-v3.0.3-linux-amd64.tar.gz && \
mv linux-amd64/helm /usr/local/bin/ddc-helm && \
chmod u+x /usr/local/bin/ddc-helm && \
rm -f helm-v3.0.3-linux-amd64.tar.gz
rm -f helm-v3.0.3-linux-amd64.tar.gz; fi

ENV K8S_VERSION v1.14.8
RUN curl -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl && chmod +x /usr/local/bin/kubectl
RUN if [ `uname -m` == "aarch64" ] ; then ARCH="arm64"; else ARCH="amd64"; fi
RUN curl -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/${ARCH}/kubectl && chmod +x /usr/local/bin/kubectl

ADD charts/ /charts

Expand Down
11 changes: 8 additions & 3 deletions docker/Dockerfile.goosefsruntime
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@ RUN apk add --update curl tzdata iproute2 bash libc6-compat vim && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone

RUN curl -o helm-v3.0.3-linux-amd64.tar.gz http://aliacs-k8s-cn-hongkong.oss-cn-hongkong.aliyuncs.com/public/pkg/helm/helm-v3.0.3-linux-amd64.tar.gz && \
RUN if [ `uname -m` == "aarch64" ] ; then curl -o helm-v3.0.3-linux-arm64.tar.gz https://get.helm.sh/helm-v3.7.2-linux-arm64.tar.gz && \
tar -xvf helm-v3.0.3-linux-arm64.tar.gz && \
mv linux-arm64/helm /usr/local/bin/ddc-helm && \
chmod u+x /usr/local/bin/ddc-helm && \
rm -f helm-v3.0.3-linux-arm64.tar.gz; else curl -o helm-v3.0.3-linux-amd64.tar.gz http://aliacs-k8s-cn-hongkong.oss-cn-hongkong.aliyuncs.com/public/pkg/helm/helm-v3.0.3-linux-amd64.tar.gz && \
tar -xvf helm-v3.0.3-linux-amd64.tar.gz && \
mv linux-amd64/helm /usr/local/bin/ddc-helm && \
chmod u+x /usr/local/bin/ddc-helm && \
rm -f helm-v3.0.3-linux-amd64.tar.gz
rm -f helm-v3.0.3-linux-amd64.tar.gz; fi

ENV K8S_VERSION v1.14.8
RUN curl -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl && chmod +x /usr/local/bin/kubectl
RUN if [ `uname -m` == "aarch64" ] ; then ARCH="arm64"; else ARCH="amd64"; fi
RUN curl -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/${ARCH}/kubectl && chmod +x /usr/local/bin/kubectl

ADD charts/ /charts

Expand Down
11 changes: 8 additions & 3 deletions docker/Dockerfile.jindoruntime
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@ RUN apk add --update curl tzdata iproute2 bash libc6-compat vim && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone

RUN curl -o helm-v3.0.3-linux-amd64.tar.gz http://aliacs-k8s-cn-hongkong.oss-cn-hongkong.aliyuncs.com/public/pkg/helm/helm-v3.0.3-linux-amd64.tar.gz && \
RUN if [ `uname -m` == "aarch64" ] ; then curl -o helm-v3.0.3-linux-arm64.tar.gz https://get.helm.sh/helm-v3.7.2-linux-arm64.tar.gz && \
tar -xvf helm-v3.0.3-linux-arm64.tar.gz && \
mv linux-arm64/helm /usr/local/bin/ddc-helm && \
chmod u+x /usr/local/bin/ddc-helm && \
rm -f helm-v3.0.3-linux-arm64.tar.gz; else curl -o helm-v3.0.3-linux-amd64.tar.gz http://aliacs-k8s-cn-hongkong.oss-cn-hongkong.aliyuncs.com/public/pkg/helm/helm-v3.0.3-linux-amd64.tar.gz && \
tar -xvf helm-v3.0.3-linux-amd64.tar.gz && \
mv linux-amd64/helm /usr/local/bin/ddc-helm && \
chmod u+x /usr/local/bin/ddc-helm && \
rm -f helm-v3.0.3-linux-amd64.tar.gz
rm -f helm-v3.0.3-linux-amd64.tar.gz; fi

ENV K8S_VERSION v1.14.8
RUN curl -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl && chmod +x /usr/local/bin/kubectl
RUN if [ `uname -m` == "aarch64" ] ; then ARCH="arm64"; else ARCH="amd64"; fi
RUN curl -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/${ARCH}/kubectl && chmod +x /usr/local/bin/kubectl

ADD charts/jindofs /charts/jindofs
ADD charts/jindofsx /charts/jindofsx
Expand Down
11 changes: 8 additions & 3 deletions docker/Dockerfile.juicefsruntime
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@ RUN apk add --update curl tzdata iproute2 bash libc6-compat vim && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone

RUN curl -o helm-v3.0.3-linux-amd64.tar.gz http://aliacs-k8s-cn-hongkong.oss-cn-hongkong.aliyuncs.com/public/pkg/helm/helm-v3.0.3-linux-amd64.tar.gz && \
RUN if [ `uname -m` == "aarch64" ] ; then curl -o helm-v3.0.3-linux-arm64.tar.gz https://get.helm.sh/helm-v3.7.2-linux-arm64.tar.gz && \
tar -xvf helm-v3.0.3-linux-arm64.tar.gz && \
mv linux-arm64/helm /usr/local/bin/ddc-helm && \
chmod u+x /usr/local/bin/ddc-helm && \
rm -f helm-v3.0.3-linux-arm64.tar.gz; else curl -o helm-v3.0.3-linux-amd64.tar.gz http://aliacs-k8s-cn-hongkong.oss-cn-hongkong.aliyuncs.com/public/pkg/helm/helm-v3.0.3-linux-amd64.tar.gz && \
tar -xvf helm-v3.0.3-linux-amd64.tar.gz && \
mv linux-amd64/helm /usr/local/bin/ddc-helm && \
chmod u+x /usr/local/bin/ddc-helm && \
rm -f helm-v3.0.3-linux-amd64.tar.gz
rm -f helm-v3.0.3-linux-amd64.tar.gz; fi

ENV K8S_VERSION v1.14.8
RUN curl -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl && chmod +x /usr/local/bin/kubectl
RUN if [ `uname -m` == "aarch64" ] ; then ARCH="arm64"; else ARCH="amd64"; fi
RUN curl -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/${ARCH}/kubectl && chmod +x /usr/local/bin/kubectl

ADD charts/ /charts

Expand Down
3 changes: 2 additions & 1 deletion docker/Dockerfile.webhook
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ RUN apk add --update curl tzdata iproute2 bash libc6-compat vim && \
echo "Asia/Shanghai" > /etc/timezone

ENV K8S_VERSION v1.14.8
RUN curl -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl && chmod +x /usr/local/bin/kubectl
RUN if [ `uname -m` == "aarch64" ] ; then ARCH="arm64"; else ARCH="amd64"; fi
RUN curl -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/${ARCH}/kubectl && chmod +x /usr/local/bin/kubectl

COPY --from=builder /go/bin/fluid-webhook /usr/local/bin/fluid-webhook
COPY --from=builder /go/bin/dlv /usr/local/bin/dlv
Expand Down
3 changes: 3 additions & 0 deletions docs/en/dev/how_to_develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ By default, the binary would be put under `<fluid-path>/bin`.

# build all images
$ make docker-build-all

# build and push all images using docker buildx
$ make docker-buildx-all
```
Before running Fluid, you need to push the built image to an accessible image registry.

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/dev/how_to_develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,4 @@ $ dlv debug --headless --listen ":12345" --log --api-version=2 cmd/alluxio/main.
$ dlv connect "<remote-addr>:12345" --api-version=2
```

> 注意:要进行远程调试,请确保远程主机指定的端口未被占用并且已经对远程主机的防火墙进行了适当的配置
> 注意:要进行远程调试,请确保远程主机指定的端口未被占用并且已经对远程主机的防火墙进行了适当的配置

0 comments on commit d20794e

Please sign in to comment.