diff options
| author | TianTianBigWang <zilong.wang@daocloud.io> | 2022-02-27 20:48:00 +0800 |
|---|---|---|
| committer | TianTianBigWang <zilong.wang@daocloud.io> | 2022-03-02 19:25:38 +0800 |
| commit | 9f90df448087ec2c041ae9971d938bac19e324f1 (patch) | |
| tree | ce630b2a72b37c99c1dbaca31d0c6407a90ce3d8 /build | |
| parent | Merge pull request #3625 from zhu733756/buildx (diff) | |
| download | kubeedge-9f90df448087ec2c041ae9971d938bac19e324f1.tar.gz | |
add edgecore image build script
Signed-off-by: TianTianBigWang <zilong.wang@daocloud.io>
Diffstat (limited to 'build')
| -rw-r--r-- | build/docker/installation-package.dockerfile | 14 | ||||
| -rwxr-xr-x | build/docker/installation-package.sh | 34 |
2 files changed, 48 insertions, 0 deletions
diff --git a/build/docker/installation-package.dockerfile b/build/docker/installation-package.dockerfile new file mode 100644 index 000000000..a7c59b538 --- /dev/null +++ b/build/docker/installation-package.dockerfile @@ -0,0 +1,14 @@ +FROM kubeedge/build-tools:latest as builder +WORKDIR /work +ADD . . +RUN mkdir -p bin && \ + make WHAT=edgecore && cp _output/local/bin/edgecore bin/edgecore && \ + make WHAT=keadm && cp _output/local/bin/keadm bin/keadm + +FROM ubuntu:18.04 +COPY --from=builder /work/_output/local/bin/edgecore /usr/local/bin/edgecore +COPY --from=builder /work/_output/local/bin/keadm /usr/local/bin/keadm + +WORKDIR /etc/kubeedge +# Custom image can add more content here. +# e.g. config diff --git a/build/docker/installation-package.sh b/build/docker/installation-package.sh new file mode 100755 index 000000000..96326f014 --- /dev/null +++ b/build/docker/installation-package.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +set -e + +REPOSITORY=${REPOSITORY:-"kubeedge/installation-package"} +RELEASE_VERSION=$(git describe --tags) +pushTag="$1" +WORK_DIR=$(cd "$(dirname "$0")";pwd) +ARCHS=(amd64 arm64 arm) + +if ! [ "$(docker version)" ]; then + echo "docker check failed" + exit 1 +fi + +for arch in "${ARCHS[@]}" ; do + docker buildx build --no-cache --platform "$arch" -t "$REPOSITORY":"$RELEASE_VERSION"-"$arch" -f "$WORK_DIR/installation-package.dockerfile" -o type=docker . +done + +if [ "$pushTag" = 'push' ]; then + echo "push edgecore image" + manifestCreateCmd="docker manifest create $REPOSITORY:$RELEASE_VERSION" + for arch in "${ARCHS[@]}" ; do + docker push "$REPOSITORY":"$RELEASE_VERSION"-"$arch" + manifestCreateCmd="$manifestCreateCmd $REPOSITORY:$RELEASE_VERSION-$arch" + done + echo "package image manifest and push" + doCreate="$($manifestCreateCmd)" + echo "$doCreate" + docker manifest push "$REPOSITORY":"$RELEASE_VERSION" +else + echo 'image save in local' +fi + |
