Skip to content

Commit 569534e

Browse files
committed
fix: review format support
1 parent 99d649c commit 569534e

3 files changed

Lines changed: 46 additions & 52 deletions

File tree

hyperf/.scripts/setup-dev.sh

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,43 @@ set -e
22

33
SONAR_SCANNER_VERSION=6.2.1.4610
44

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
844
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

hyperf/.scripts/setup.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ git config --global --add safe.directory /opt/www
66
git config --global init.defaultBranch main
77

88
# - config PHP
9-
cd /etc/php83
109
{
1110
echo "upload_max_filesize=128M"
1211
echo "post_max_size=128M"
1312
echo "memory_limit=1G"
1413
echo "date.timezone=${TIMEZONE}"
15-
} | tee conf.d/99_overrides.ini
14+
} | tee /etc/php83/conf.d/zzz_0_php.ini
1615

1716
# - config timezone
1817
ln -sf "/usr/share/zoneinfo/${TIMEZONE}" /etc/localtime

hyperf/Dockerfile

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ RUN apk update && \
1515
apk add --no-cache bash curl git unzip && \
1616
mkdir -p /opt/www
1717

18-
COPY .scripts /devitools/.scripts
19-
20-
WORKDIR /opt/www
21-
2218
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
2319

2420
RUN apk add --no-cache \
@@ -54,21 +50,23 @@ RUN apk add --no-cache \
5450
php83-xmlwriter=8.3.15-r0 \
5551
php83-zip=8.3.15-r0 \
5652
&& ln -sf /usr/bin/php83 /usr/bin/php \
57-
&& mv /etc/php/php.ini /etc/php83/conf.d/zphp.ini \
53+
&& mv /etc/php/php.ini /etc/php83/conf.d/zzz_1_php.ini \
5854
&& mv /etc/php/php-fpm.conf /etc/php83/php-fpm.d/zphp.conf
5955

6056
COPY --from=composer/composer:2.8.5-bin /composer /usr/local/bin/composer
6157

58+
COPY .scripts /devitools/.scripts
59+
6260
# update
6361
RUN set -ex \
64-
&& if [ "$APP_TARGET" = "dev" ]; then \
65-
bash /devitools/.scripts/setup-dev.sh; \
66-
fi \
6762
# ---------- apply settings -------\
6863
&& bash /devitools/.scripts/setup.sh "$TIMEZONE" \
64+
&& bash /devitools/.scripts/setup-dev.sh "$APP_TARGET" \
6965
# ---------- clear works ----------\
7066
&& rm -rf /var/cache/apk/* /tmp/* /usr/share/man
7167

68+
WORKDIR /opt/www
69+
7270
EXPOSE 9501
7371

7472
ENTRYPOINT [ "php", "/opt/www/bin/hyperf.php" ]

0 commit comments

Comments
 (0)