11.PHONY : all build test validate package package-helm clean
22
3- all : build
3+ # The default target is to build and package everything
4+ all : package
45
6+ # build is now responsible for building the final image AND extracting the binary
57build :
6- @echo " --- Building webhook binary ---"
8+ @echo " --- Building Webhook Image & Binary ---"
79 @bash -c ' source scripts/version && \
8- mkdir -p bin && \
910 docker build \
1011 --file package/Dockerfile \
11- --target binary \
1212 --build-arg ARCH=$$ {ARCH} \
1313 --build-arg VERSION=$$ {VERSION} \
1414 --build-arg COMMIT=$$ {COMMIT} \
15- -t rancher/webhook:binary- $$ {TAG} \
15+ -t rancher/webhook:$$ {TAG} \
1616 . && \
17- CONTAINER_ID=$$(docker create rancher/webhook:binary-$${TAG} echo ) && \
18- docker cp $$ CONTAINER_ID:/webhook ./bin/webhook && \
17+ mkdir -p bin && \
18+ CONTAINER_ID=$$(docker create rancher/webhook:$${TAG} echo ) && \
19+ docker cp $$ CONTAINER_ID:/usr/bin/webhook ./bin/webhook && \
1920 docker rm $$ CONTAINER_ID'
2021
2122test :
@@ -27,8 +28,14 @@ validate:
2728package-helm :
2829 ./scripts/package-helm
2930
31+ # package now depends on the build being complete, and just creates release artifacts
3032package : build package-helm
31- ./scripts/package
33+ @echo " --- Packaging Release Artifacts ---"
34+ @bash -c ' source scripts/version && \
35+ mkdir -p dist && \
36+ chmod a+rwx dist && \
37+ docker save -o dist/rancher-webhook-image.tar rancher/webhook:$$ {TAG} && \
38+ echo IMAGE_TAG=$$ {TAG} > dist/image_tag'
3239
3340clean :
3441 rm -rf bin dist
0 commit comments