-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sh
executable file
·55 lines (41 loc) · 1.42 KB
/
build.sh
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
set -eo pipefail
version=$1
arch=$2
params=$3
if [ -z "$version" ]; then
echo "Usage: $0 <version> <arch>"
exit 1
fi
if [ -z "$arch" ]; then
echo "Usage: $0 <version> <arch>"
exit 1
fi
echo "Building version $version"
rm -rf rootfs
mkdir rootfs
mkdir rootfs/tmp
if [[ ! -d db ]]; then
git clone -b ubuntu-23.10-php https://github.com/shyim/chisel-releases.git db
fi
chisel cut --arch=$arch --release ./db --root rootfs/ php8.2-cli_base php8.2-common_phar-cli php8.2-common_ctype-cli php8.2-mbstring_cli php8.2-intl_cli php8.2-xml_xml-cli dash_bins coreutils_bins grep_bins bash_bins ca-certificates_data openssl_data
if [[ -e ".cache/danger-${version}.phar" ]]; then
echo "Using cached version"
else
mkdir -p .cache || true
curl -q -L -o ".cache/danger-${version}.phar" "https://github.com/shyim/danger-php/releases/download/${version}/danger.phar"
fi
mkdir -p rootfs/bin
echo "#/bin/sh" > rootfs/bin/danger
echo "php /danger.phar \"\$@\"" >> rootfs/bin/danger
chmod +x rootfs/bin/danger
mkdir -p rootfs/app/bin
echo "#/bin/sh" > rootfs/app/bin/danger
echo "php /danger.phar \"\$@\"" >> rootfs/app/bin/danger
chmod +x rootfs/app/bin/danger
cp ".cache/danger-${version}.phar" rootfs/danger.phar
chmod +x rootfs/danger.phar
docker build --platform "linux/${arch}" -t "ghcr.io/shyim/danger-php:test" .
if [[ "$params" == "--push" ]]; then
docker push "ghcr.io/shyim/danger-php:${version}-${arch}"
fi