mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
Fix docker doctor fix pkgroot volume overwrite bug
This commit is contained in:
parent
38ec03fe30
commit
a79564f685
@ -3,7 +3,7 @@
|
||||
set -e
|
||||
|
||||
# This file is using docker to run commands
|
||||
SPC_DOCKER_VERSION=v5
|
||||
SPC_DOCKER_VERSION=v6
|
||||
|
||||
# Detect docker can run
|
||||
if ! which docker >/dev/null; then
|
||||
@ -122,6 +122,9 @@ ADD ./src /app/src
|
||||
COPY ./composer.* /app/
|
||||
ADD ./bin /app/bin
|
||||
RUN composer install --no-dev
|
||||
ADD ./config /app/config
|
||||
RUN PKG_ROOT_PATH=/app/pkgroot-private bin/spc doctor --auto-fix
|
||||
RUN PKG_ROOT_PATH=/app/pkgroot-private bin/spc install-pkg upx
|
||||
EOF
|
||||
fi
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
set -e
|
||||
|
||||
# This file is using docker to run commands
|
||||
SPC_DOCKER_VERSION=v5
|
||||
SPC_DOCKER_VERSION=v6
|
||||
|
||||
# Detect docker can run
|
||||
if ! which docker >/dev/null; then
|
||||
@ -112,7 +112,8 @@ ENV SPC_LIBC=glibc
|
||||
ENV PATH="/app/bin:/cmake/bin:/opt/rh/devtoolset-10/root/usr/bin:\$PATH"
|
||||
|
||||
ADD ./config /app/config
|
||||
RUN CC=gcc bin/spc doctor --auto-fix --debug
|
||||
RUN CC=gcc PKG_ROOT_PATH=/app/pkgroot-private bin/spc doctor --auto-fix --debug
|
||||
RUN PKG_ROOT_PATH=/app/pkgroot-private bin/spc install-pkg upx
|
||||
RUN if [ -f /app/buildroot/bin/re2c ]; then \
|
||||
cp /app/buildroot/bin/re2c /usr/local/bin/re2c ;\
|
||||
fi
|
||||
|
||||
@ -29,6 +29,18 @@ class PkgConfigCheck
|
||||
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')]
|
||||
public function installPkgConfig(): bool
|
||||
{
|
||||
|
||||
@ -40,6 +40,10 @@ class GlobalEnvManager
|
||||
if (is_unix()) {
|
||||
self::addPathIfNotExists(BUILD_BIN_PATH);
|
||||
self::addPathIfNotExists(PKG_ROOT_PATH . '/bin');
|
||||
// internally use `WORKING_DIR/pkgroot-private` to avoid volume mount issues in Docker
|
||||
if (is_dir(WORKING_DIR . '/pkgroot-private/bin')) {
|
||||
self::addPathIfNotExists(WORKING_DIR . '/pkgroot-private/bin');
|
||||
}
|
||||
self::putenv('PKG_CONFIG_PATH=' . BUILD_LIB_PATH . '/pkgconfig');
|
||||
}
|
||||
|
||||
|
||||
@ -23,6 +23,7 @@ class PkgConfigUtil
|
||||
{
|
||||
// Find pkg-config executable
|
||||
$find_list = [
|
||||
WORKING_DIR . '/pkgroot-private/bin/pkg-config', // used in Docker build, which is installed inside the container to avoid volume mounting issues
|
||||
PKG_ROOT_PATH . '/bin/pkg-config',
|
||||
BUILD_BIN_PATH . '/pkg-config',
|
||||
];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user