|
2 | 2 |
|
3 | 3 | SONAR_SCANNER_VERSION=6.2.1.4610 |
4 | 4 |
|
5 | | -if ! command -v apk &> /dev/null; then |
6 | | - echo "Error: 'apk' not found. Make sure you are running this script in an Alpine Linux environment." >&2 |
7 | | - exit 1 |
| 5 | +if [ "$1" = "dev" ]; then |
| 6 | + if ! command -v apk &> /dev/null; then |
| 7 | + echo "Error: 'apk' not found. Make sure you are running this script in an Alpine Linux environment." >&2 |
| 8 | + exit 1 |
| 9 | + fi |
| 10 | + |
| 11 | + if ! command -v composer &> /dev/null; then |
| 12 | + echo "Error: 'composer' not found. Make sure it is installed and accessible in the system PATH." >&2 |
| 13 | + exit 1 |
| 14 | + fi |
| 15 | + |
| 16 | + echo "[$1] Installing PHP extensions and dependencies" |
| 17 | + |
| 18 | + apk add --no-cache \ |
| 19 | + libstdc++ \ |
| 20 | + ca-certificates \ |
| 21 | + libc6-compat \ |
| 22 | + openjdk17-jre \ |
| 23 | + php83-pecl-xdebug \ |
| 24 | + php83-pecl-pcov |
| 25 | + |
| 26 | + { |
| 27 | + echo "opcache.enable=0" |
| 28 | + echo "opcache.interned_strings_buffer=72" |
| 29 | + echo "xdebug.mode=develop,debug,coverage" |
| 30 | + echo "xdebug.idekey=PHPSTORM" |
| 31 | + } >> /etc/php83/conf.d/zzz_2_php.ini |
| 32 | + |
| 33 | + mkdir -p /opt |
| 34 | + curl -fSL https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux-x64.zip \ |
| 35 | + -o /opt/sonar-scanner.zip |
| 36 | + |
| 37 | + unzip -qq /opt/sonar-scanner.zip -d /opt |
| 38 | + mv /opt/sonar-scanner-${SONAR_SCANNER_VERSION}-linux-x64 /sonar-scanner |
| 39 | + rm /opt/sonar-scanner.zip |
| 40 | + |
| 41 | + ln -s /sonar-scanner/bin/sonar-scanner /bin/sonar-scanner |
| 42 | + |
| 43 | + sed -i 's/use_embedded_jre=true/use_embedded_jre=false/g' /sonar-scanner/bin/sonar-scanner |
8 | 44 | fi |
9 | | - |
10 | | -if ! command -v composer &> /dev/null; then |
11 | | - echo "Error: 'composer' not found. Make sure it is installed and accessible in the system PATH." >&2 |
12 | | - exit 1 |
13 | | -fi |
14 | | - |
15 | | -echo "[$1] Installing PHP extensions and dependencies" |
16 | | - |
17 | | -apk add --no-cache \ |
18 | | - libstdc++ \ |
19 | | - ca-certificates \ |
20 | | - curl \ |
21 | | - unzip \ |
22 | | - libc6-compat \ |
23 | | - openjdk17-jre \ |
24 | | - php83-pecl-xdebug \ |
25 | | - php83-pecl-pcov |
26 | | - |
27 | | -cd /etc/php83 |
28 | | -{ |
29 | | - echo "opcache.enable=0" |
30 | | - echo "opcache.interned_strings_buffer=72" |
31 | | -} >> conf.d/99_php.ini |
32 | | -{ |
33 | | - echo "xdebug.mode=develop,debug,coverage" |
34 | | - echo "xdebug.idekey=PHPSTORM" |
35 | | -} >> conf.d/50_xdebug.ini |
36 | | - |
37 | | -mkdir -p /opt |
38 | | -curl -fSL https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux-x64.zip \ |
39 | | - -o /opt/sonar-scanner.zip |
40 | | - |
41 | | -unzip -qq /opt/sonar-scanner.zip -d /opt |
42 | | -mv /opt/sonar-scanner-${SONAR_SCANNER_VERSION}-linux-x64 /sonar-scanner |
43 | | -rm /opt/sonar-scanner.zip |
44 | | - |
45 | | -ln -s /sonar-scanner/bin/sonar-scanner /bin/sonar-scanner |
46 | | - |
47 | | -sed -i 's/use_embedded_jre=true/use_embedded_jre=false/g' /sonar-scanner/bin/sonar-scanner |
0 commit comments