Skip to content

Commit d82c86c

Browse files
authored
Fix docker doctor fix pkgroot volume overwrite bug (#882)
* Fix docker doctor fix pkgroot volume overwrite bug * cs fix * Remove pkgroot-private * Use arch-specified pkgroot * Update setup-runtime php version * Add docker-entrypoint.sh * Update dependencies * cs fix * test
2 parents 2eeba33 + 4e74ac1 commit d82c86c

File tree

12 files changed

+256
-177
lines changed

12 files changed

+256
-177
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ packlib_files.txt
3434
/bin/*
3535
!/bin/spc*
3636
!/bin/setup-runtime*
37+
!/bin/docker-entrypoint.sh
3738

3839
# exclude windows build tools
3940
/php-sdk-binary-tools/

bin/docker-entrypoint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
TARGET_DIR="/app/pkgroot/$(uname -m)-linux"
4+
BACKUP_DIR="/app/pkgroot-private"
5+
# copy private pkgroot to pkgroot if pkgroot is empty
6+
if [ ! -d "$TARGET_DIR" ] || [ -z "$(ls -A "$TARGET_DIR")" ]; then
7+
echo "* Copying private pkgroot to pkgroot ..."
8+
rm -rf "$TARGET_DIR"
9+
cp -r "$BACKUP_DIR" "$TARGET_DIR"
10+
fi
11+
exec "$@"

bin/setup-runtime

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ __DIR__=$(cd "$(dirname "$0")" && pwd)
2525
__PROJECT__=$(cd "${__DIR__}"/../ && pwd)
2626

2727
# set download dir
28-
__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.4.4-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz"
28+
__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.4.12-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz"
2929
__COMPOSER_URL__="https://getcomposer.org/download/latest-stable/composer.phar"
3030

3131
# use china mirror
@@ -45,7 +45,7 @@ done
4545

4646
case "$mirror" in
4747
china)
48-
__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.4.4-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz"
48+
__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.4.12-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz"
4949
__COMPOSER_URL__="https://mirrors.tencent.com/composer/composer.phar"
5050
;;
5151

bin/spc-alpine-docker

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -e
44

55
# This file is using docker to run commands
6-
SPC_DOCKER_VERSION=v5
6+
SPC_DOCKER_VERSION=v6
77

88
# Detect docker can run
99
if ! which docker >/dev/null; then
@@ -122,6 +122,14 @@ ADD ./src /app/src
122122
COPY ./composer.* /app/
123123
ADD ./bin /app/bin
124124
RUN composer install --no-dev
125+
ADD ./config /app/config
126+
RUN bin/spc doctor --auto-fix
127+
RUN bin/spc install-pkg upx
128+
129+
RUN mv /app/pkgroot/\$(uname -m)-linux /app/pkgroot-private
130+
ADD bin/docker-entrypoint.sh /bin/docker-entrypoint.sh
131+
RUN chmod +x /bin/docker-entrypoint.sh
132+
ENTRYPOINT ["/bin/docker-entrypoint.sh"]
125133
EOF
126134
fi
127135

bin/spc-gnu-docker

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -e
44

55
# This file is using docker to run commands
6-
SPC_DOCKER_VERSION=v5
6+
SPC_DOCKER_VERSION=v6
77

88
# Detect docker can run
99
if ! which docker >/dev/null; then
@@ -113,6 +113,7 @@ ENV PATH="/app/bin:/cmake/bin:/opt/rh/devtoolset-10/root/usr/bin:\$PATH"
113113
114114
ADD ./config /app/config
115115
RUN CC=gcc bin/spc doctor --auto-fix --debug
116+
RUN bin/spc install-pkg upx
116117
RUN if [ -f /app/buildroot/bin/re2c ]; then \
117118
cp /app/buildroot/bin/re2c /usr/local/bin/re2c ;\
118119
fi
@@ -132,6 +133,11 @@ RUN curl -o automake.tgz -fsSL https://ftp.gnu.org/gnu/automake/automake-1.17.ta
132133
make && \
133134
make install && \
134135
ln -sf /usr/local/bin/automake /usr/bin/automake
136+
137+
RUN mv /app/pkgroot/\$(uname -m)-linux /app/pkgroot-private
138+
ADD bin/docker-entrypoint.sh /bin/docker-entrypoint.sh
139+
RUN chmod +x /bin/docker-entrypoint.sh
140+
ENTRYPOINT ["/bin/docker-entrypoint.sh"]
135141
EOF
136142
fi
137143

0 commit comments

Comments
 (0)