Skip to content

Commit

Permalink
build: consolidate different package targets
Browse files Browse the repository at this point in the history
Signed-off-by: Zespre Chang <zespre.chang@suse.com>
  • Loading branch information
starbops committed Apr 25, 2024
1 parent 2af633e commit b5aae01
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 24 deletions.
2 changes: 0 additions & 2 deletions scripts/default
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ cd $(dirname $0)

./build
./package
./package-agent
./package-webhook
27 changes: 5 additions & 22 deletions scripts/package
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
#!/bin/bash
set -e

source $(dirname $0)/version
cd $(dirname $0)

cd $(dirname $0)/..
echo "Packaging..."

echo "Packaging controller..."

# Build container images
IMAGE=${REPO}/vm-dhcp-controller:${TAG}
DOCKERFILE=package/Dockerfile

buildx build --load \
-f ${DOCKERFILE} -t ${IMAGE} .
echo Built ${IMAGE}

# Image push (if specified)
IMAGE_PUSH=${REPO}/harvester-vm-dhcp-controller:${IMAGE_PUSH_TAG}
docker tag "${IMAGE}" "${IMAGE_PUSH}"
echo Tagged "${IMAGE_PUSH}"

DOCKER_CONFIG=".docker"
if [[ -n ${PUSH} ]];then
docker --config=${DOCKER_CONFIG} push "${IMAGE_PUSH}"
echo Pushed "${IMAGE_PUSH}"
fi
./package-controller
./package-agent
./package-webhook
27 changes: 27 additions & 0 deletions scripts/package-controller
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
set -e

source $(dirname $0)/version

cd $(dirname $0)/..

echo "Packaging controller..."

# Build container images
IMAGE=${REPO}/vm-dhcp-controller:${TAG}
DOCKERFILE=package/Dockerfile

buildx build --load \
-f ${DOCKERFILE} -t ${IMAGE} .
echo Built ${IMAGE}

# Image push (if specified)
IMAGE_PUSH=${REPO}/harvester-vm-dhcp-controller:${IMAGE_PUSH_TAG}
docker tag "${IMAGE}" "${IMAGE_PUSH}"
echo Tagged "${IMAGE_PUSH}"

DOCKER_CONFIG=".docker"
if [[ -n ${PUSH} ]];then
docker --config=${DOCKER_CONFIG} push "${IMAGE_PUSH}"
echo Pushed "${IMAGE_PUSH}"
fi

0 comments on commit b5aae01

Please sign in to comment.