forked from sensu/sensu-ruby32-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_platform.sh
More file actions
executable file
·27 lines (24 loc) · 1.07 KB
/
build_platform.sh
File metadata and controls
executable file
·27 lines (24 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
platform=debian13
ruby_version=3.2.2
asset_version=0.1.2
asset_filename=sensu-ruby32-runtime_${asset_version}_ruby-${ruby_version}_${platform}_linux_amd64.tar.gz
asset_image=sensu-ruby32-runtime-${ruby_version}-${platform}:${asset_version}
echo "Platform: ${platform}"
echo "Check for asset file: ${asset_filename}"
if [ -f "$PWD/dist/${asset_filename}" ]; then
echo "File: "$PWD/dist/${asset_filename}" already exists!!!"
exit 1
else
echo "Check for docker image: ${asset_image}"
if [[ "$(docker images -q ${asset_image} 2> /dev/null)" == "" ]]; then
echo "Docker image not found...we can build"
echo "Building Docker Image: sensu-ruby32-runtime:${ruby_version}-${platform}"
docker build --platform linux/amd64 --build-arg "RUBY_VERSION=$ruby_version" --build-arg "ASSET_VERSION=$asset_version" -t ${asset_image} -f Dockerfile.${platform} .
echo "Making Asset: /assets/${asset_filename}"
docker run --platform linux/amd64 -v "$PWD/dist:/dist" ${asset_image} cp /assets/${asset_filename} /dist/
else
echo "Image already exists!!!"
exit 1
fi
fi