mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +08:00
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
This commit is contained in:
commit
d82c86cf62
1
.gitignore
vendored
1
.gitignore
vendored
@ -34,6 +34,7 @@ packlib_files.txt
|
|||||||
/bin/*
|
/bin/*
|
||||||
!/bin/spc*
|
!/bin/spc*
|
||||||
!/bin/setup-runtime*
|
!/bin/setup-runtime*
|
||||||
|
!/bin/docker-entrypoint.sh
|
||||||
|
|
||||||
# exclude windows build tools
|
# exclude windows build tools
|
||||||
/php-sdk-binary-tools/
|
/php-sdk-binary-tools/
|
||||||
|
|||||||
11
bin/docker-entrypoint.sh
Normal file
11
bin/docker-entrypoint.sh
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
TARGET_DIR="/app/pkgroot/$(uname -m)-linux"
|
||||||
|
BACKUP_DIR="/app/pkgroot-private"
|
||||||
|
# copy private pkgroot to pkgroot if pkgroot is empty
|
||||||
|
if [ ! -d "$TARGET_DIR" ] || [ -z "$(ls -A "$TARGET_DIR")" ]; then
|
||||||
|
echo "* Copying private pkgroot to pkgroot ..."
|
||||||
|
rm -rf "$TARGET_DIR"
|
||||||
|
cp -r "$BACKUP_DIR" "$TARGET_DIR"
|
||||||
|
fi
|
||||||
|
exec "$@"
|
||||||
@ -25,7 +25,7 @@ __DIR__=$(cd "$(dirname "$0")" && pwd)
|
|||||||
__PROJECT__=$(cd "${__DIR__}"/../ && pwd)
|
__PROJECT__=$(cd "${__DIR__}"/../ && pwd)
|
||||||
|
|
||||||
# set download dir
|
# set download dir
|
||||||
__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.4.4-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz"
|
__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.4.12-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz"
|
||||||
__COMPOSER_URL__="https://getcomposer.org/download/latest-stable/composer.phar"
|
__COMPOSER_URL__="https://getcomposer.org/download/latest-stable/composer.phar"
|
||||||
|
|
||||||
# use china mirror
|
# use china mirror
|
||||||
@ -45,7 +45,7 @@ done
|
|||||||
|
|
||||||
case "$mirror" in
|
case "$mirror" in
|
||||||
china)
|
china)
|
||||||
__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.4.4-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz"
|
__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.4.12-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz"
|
||||||
__COMPOSER_URL__="https://mirrors.tencent.com/composer/composer.phar"
|
__COMPOSER_URL__="https://mirrors.tencent.com/composer/composer.phar"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
# This file is using docker to run commands
|
# This file is using docker to run commands
|
||||||
SPC_DOCKER_VERSION=v5
|
SPC_DOCKER_VERSION=v6
|
||||||
|
|
||||||
# Detect docker can run
|
# Detect docker can run
|
||||||
if ! which docker >/dev/null; then
|
if ! which docker >/dev/null; then
|
||||||
@ -122,6 +122,14 @@ ADD ./src /app/src
|
|||||||
COPY ./composer.* /app/
|
COPY ./composer.* /app/
|
||||||
ADD ./bin /app/bin
|
ADD ./bin /app/bin
|
||||||
RUN composer install --no-dev
|
RUN composer install --no-dev
|
||||||
|
ADD ./config /app/config
|
||||||
|
RUN bin/spc doctor --auto-fix
|
||||||
|
RUN bin/spc install-pkg upx
|
||||||
|
|
||||||
|
RUN mv /app/pkgroot/\$(uname -m)-linux /app/pkgroot-private
|
||||||
|
ADD bin/docker-entrypoint.sh /bin/docker-entrypoint.sh
|
||||||
|
RUN chmod +x /bin/docker-entrypoint.sh
|
||||||
|
ENTRYPOINT ["/bin/docker-entrypoint.sh"]
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
# This file is using docker to run commands
|
# This file is using docker to run commands
|
||||||
SPC_DOCKER_VERSION=v5
|
SPC_DOCKER_VERSION=v6
|
||||||
|
|
||||||
# Detect docker can run
|
# Detect docker can run
|
||||||
if ! which docker >/dev/null; then
|
if ! which docker >/dev/null; then
|
||||||
@ -113,6 +113,7 @@ ENV PATH="/app/bin:/cmake/bin:/opt/rh/devtoolset-10/root/usr/bin:\$PATH"
|
|||||||
|
|
||||||
ADD ./config /app/config
|
ADD ./config /app/config
|
||||||
RUN CC=gcc bin/spc doctor --auto-fix --debug
|
RUN CC=gcc bin/spc doctor --auto-fix --debug
|
||||||
|
RUN bin/spc install-pkg upx
|
||||||
RUN if [ -f /app/buildroot/bin/re2c ]; then \
|
RUN if [ -f /app/buildroot/bin/re2c ]; then \
|
||||||
cp /app/buildroot/bin/re2c /usr/local/bin/re2c ;\
|
cp /app/buildroot/bin/re2c /usr/local/bin/re2c ;\
|
||||||
fi
|
fi
|
||||||
@ -132,6 +133,11 @@ RUN curl -o automake.tgz -fsSL https://ftp.gnu.org/gnu/automake/automake-1.17.ta
|
|||||||
make && \
|
make && \
|
||||||
make install && \
|
make install && \
|
||||||
ln -sf /usr/local/bin/automake /usr/bin/automake
|
ln -sf /usr/local/bin/automake /usr/bin/automake
|
||||||
|
|
||||||
|
RUN mv /app/pkgroot/\$(uname -m)-linux /app/pkgroot-private
|
||||||
|
ADD bin/docker-entrypoint.sh /bin/docker-entrypoint.sh
|
||||||
|
RUN chmod +x /bin/docker-entrypoint.sh
|
||||||
|
ENTRYPOINT ["/bin/docker-entrypoint.sh"]
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
372
composer.lock
generated
372
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -10,8 +10,6 @@ use SPC\exception\SPCInternalException;
|
|||||||
use SPC\exception\ValidationException;
|
use SPC\exception\ValidationException;
|
||||||
use SPC\exception\WrongUsageException;
|
use SPC\exception\WrongUsageException;
|
||||||
use SPC\store\Config;
|
use SPC\store\Config;
|
||||||
use SPC\store\CurlHook;
|
|
||||||
use SPC\store\Downloader;
|
|
||||||
use SPC\store\FileSystem;
|
use SPC\store\FileSystem;
|
||||||
use SPC\store\pkg\GoXcaddy;
|
use SPC\store\pkg\GoXcaddy;
|
||||||
use SPC\toolchain\GccNativeToolchain;
|
use SPC\toolchain\GccNativeToolchain;
|
||||||
|
|||||||
@ -29,6 +29,18 @@ class PkgConfigCheck
|
|||||||
return CheckResult::ok($pkgconf);
|
return CheckResult::ok($pkgconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[AsCheckItem('if pkg-config is working', level: 799)]
|
||||||
|
public function checkPkgConfigFunctional(): CheckResult
|
||||||
|
{
|
||||||
|
$pkgconf = PkgConfigUtil::findPkgConfig();
|
||||||
|
// check if pkg-config is functional
|
||||||
|
[$ret, $output] = shell()->execWithResult("{$pkgconf} --version", false);
|
||||||
|
if ($ret === 0) {
|
||||||
|
return CheckResult::ok(implode(' ', $output));
|
||||||
|
}
|
||||||
|
return CheckResult::fail('pkg-config is not functional', 'install-pkgconfig');
|
||||||
|
}
|
||||||
|
|
||||||
#[AsFixItem('install-pkgconfig')]
|
#[AsFixItem('install-pkgconfig')]
|
||||||
public function installPkgConfig(): bool
|
public function installPkgConfig(): bool
|
||||||
{
|
{
|
||||||
|
|||||||
@ -14,9 +14,9 @@ use SPC\builder\Extension;
|
|||||||
*/
|
*/
|
||||||
class ValidationException extends SPCException
|
class ValidationException extends SPCException
|
||||||
{
|
{
|
||||||
private null|array|string $validation_module = null;
|
private array|string|null $validation_module = null;
|
||||||
|
|
||||||
public function __construct(string $message = '', int $code = 0, ?\Throwable $previous = null, null|array|string $validation_module = null)
|
public function __construct(string $message = '', int $code = 0, ?\Throwable $previous = null, array|string|null $validation_module = null)
|
||||||
{
|
{
|
||||||
parent::__construct($message, $code, $previous);
|
parent::__construct($message, $code, $previous);
|
||||||
|
|
||||||
|
|||||||
@ -117,7 +117,7 @@ class LicenseDumper
|
|||||||
/**
|
/**
|
||||||
* Loads a source license file from the specified path.
|
* Loads a source license file from the specified path.
|
||||||
*/
|
*/
|
||||||
private function loadSourceFile(string $source_name, int $index, null|array|string $in_path, ?string $custom_base_path = null): string
|
private function loadSourceFile(string $source_name, int $index, array|string|null $in_path, ?string $custom_base_path = null): string
|
||||||
{
|
{
|
||||||
if (is_null($in_path)) {
|
if (is_null($in_path)) {
|
||||||
throw new SPCInternalException("source [{$source_name}] license file is not set, please check config/source.json");
|
throw new SPCInternalException("source [{$source_name}] license file is not set, please check config/source.json");
|
||||||
|
|||||||
@ -22,7 +22,10 @@ define('BUILD_BIN_PATH', FileSystem::convertPath(is_string($a = getenv('BUILD_BI
|
|||||||
// output path for shared extensions
|
// output path for shared extensions
|
||||||
define('BUILD_MODULES_PATH', FileSystem::convertPath(is_string($a = getenv('BUILD_MODULES_PATH')) ? $a : (BUILD_ROOT_PATH . '/modules')));
|
define('BUILD_MODULES_PATH', FileSystem::convertPath(is_string($a = getenv('BUILD_MODULES_PATH')) ? $a : (BUILD_ROOT_PATH . '/modules')));
|
||||||
|
|
||||||
define('PKG_ROOT_PATH', FileSystem::convertPath(is_string($a = getenv('PKG_ROOT_PATH')) ? $a : (WORKING_DIR . '/pkgroot')));
|
// pkg arch name
|
||||||
|
$_pkg_arch_name = arch2gnu(php_uname('m')) . '-' . strtolower(PHP_OS_FAMILY);
|
||||||
|
define('PKG_ROOT_PATH', FileSystem::convertPath(is_string($a = getenv('PKG_ROOT_PATH')) ? $a : (WORKING_DIR . "/pkgroot/{$_pkg_arch_name}")));
|
||||||
|
|
||||||
define('SOURCE_PATH', FileSystem::convertPath(is_string($a = getenv('SOURCE_PATH')) ? $a : (WORKING_DIR . '/source')));
|
define('SOURCE_PATH', FileSystem::convertPath(is_string($a = getenv('SOURCE_PATH')) ? $a : (WORKING_DIR . '/source')));
|
||||||
define('DOWNLOAD_PATH', FileSystem::convertPath(is_string($a = getenv('DOWNLOAD_PATH')) ? $a : (WORKING_DIR . '/downloads')));
|
define('DOWNLOAD_PATH', FileSystem::convertPath(is_string($a = getenv('DOWNLOAD_PATH')) ? $a : (WORKING_DIR . '/downloads')));
|
||||||
define('CPU_COUNT', match (PHP_OS_FAMILY) {
|
define('CPU_COUNT', match (PHP_OS_FAMILY) {
|
||||||
|
|||||||
@ -43,7 +43,7 @@ $no_strip = false;
|
|||||||
$upx = false;
|
$upx = false;
|
||||||
|
|
||||||
// whether to test frankenphp build, only available for macos and linux
|
// whether to test frankenphp build, only available for macos and linux
|
||||||
$frankenphp = true;
|
$frankenphp = false;
|
||||||
|
|
||||||
// prefer downloading pre-built packages to speed up the build process
|
// prefer downloading pre-built packages to speed up the build process
|
||||||
$prefer_pre_built = false;
|
$prefer_pre_built = false;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user