diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 28766ba..74d5224 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,4 +1,4 @@ -name: Continous integration +name: Continuous integration on: pull_request: push: @@ -34,10 +34,10 @@ jobs: needs: [test, cs] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 21 - run: > npx -p "@semantic-release/commit-analyzer" diff --git a/src/Module.php b/src/Module.php index a6ce2df..36304fb 100644 --- a/src/Module.php +++ b/src/Module.php @@ -45,6 +45,8 @@ final class Module extends \yii\base\Module 'post_max_size' => '25M' ]; + public string $envJsonFile = '/runtime/env.json'; + /** * @var array $fpmConfig Global directives * @see http://php.net/manual/en/install.fpm.configuration.php @@ -105,28 +107,11 @@ private function createEntrypoint(string $entryScript): string $result = []; $result[] = '#!/bin/sh'; - // Check if runtime directory is writable. - $result[] = << /runtime/env.json +su nobody -s /bin/touch {$this->envJsonFile} +jq -n -s 'env' > {$this->envJsonFile} if [ $? -ne 0 ]; then - echo "failed to store env in /runtime/env.json"; + echo "failed to store env in {$this->envJsonFile}"; exit 1 fi SH; @@ -174,8 +159,6 @@ public function createBuildContext( $context->from($this->baseImage); $context->run('apk add --update --no-cache jq'); - $context->run('mkdir -p /runtime && chown nobody:nobody /runtime'); - $context->volume('/runtime'); $context->copyFromLayer("/project", "0", "/build"); $context->add('/entrypoint.sh', $this->createEntrypoint($entryScript));