Validate a Docker environment
Ce contenu n’est pas encore disponible dans votre langue.
Validate the image stack separately from the application. The portable helper checks Apache, PHP-FPM and filesystem behavior; it does not install Yii, connect to a database or replace application tests.
This Docker-only package has no Composer or PHP test suite. CI runs the shared repository quality checks, Hadolint, ShellCheck, workflow security, and Docker Buildx image builds.
Tool references:
- Actionlint for GitHub Actions workflow linting.
- Codespell for spelling checks.
- Docker Buildx for image builds.
- EditorConfig Checker for EditorConfig compliance.
- Gitleaks for secret scanning.
- Hadolint for Dockerfile linting.
- Markdownlint-cli2 for Markdown linting.
- Prettier for Markdown and YAML formatting checks.
- ShellCheck for shell script linting.
- Yamllint for YAML linting.
- Zizmor for GitHub Actions security audits.
Repository quality checks
Section titled “Repository quality checks”CI runs actionlint, codespell, EditorConfig Checker, markdownlint-cli2, Prettier and yamllint through the shared
yii2-framework/actions quality workflow. The repository’s formatting rules
stay in .editorconfig.
Make actionlint and ShellCheck available on PATH to lint workflows locally.
actionlintWorkflow security checks
Section titled “Workflow security checks”CI runs zizmor and Gitleaks through the shared security workflow. Gitleaks uses its default rules. The Gitleaks scan
requires GITLEAKS_LICENSE in the workflow.
Make zizmor available on PATH to audit the workflows locally with the same pedantic persona.
zizmor --persona=pedantic .githubZizmor needs GitHub API access for its online audits. Use the offline flag to run without API access.
zizmor --persona=pedantic --offline .githubThe shared workflows’ pinned tool versions and hosted security credentials are separate from these local commands.
Report hosted CI execution separately and keep generated reports in ignored internal/.
Dockerfile and shell script linters
Section titled “Dockerfile and shell script linters”Hadolint and ShellCheck run through digest-pinned container images with the configuration in .github/linters. The
helper requires Docker and matches the hadolint and shellcheck jobs of the quality workflow:
bash .github/scripts/lint.sh hadolintbash .github/scripts/lint.sh shellcheckThe Docker image validation and build steps below also require Docker.
Run an isolated image check
Section titled “Run an isolated image check”From a source checkout, pull a verified release and run the skill’s portable helper:
docker pull ghcr.io/yii2-extensions/apache:8.5-debian-dev-v2.0.0bash skills/yii2-docker-environment/scripts/validate.sh \ ghcr.io/yii2-extensions/apache:8.5-debian-dev-v2.0.0Requirements: Bash, Docker with a reachable local rootful Linux daemon without user-namespace remapping, curl, Python 3,
and a non-root host user. The image must already exist locally. Rootless Docker and userns-remap change
bind-mount UID/GID mapping; the helper rejects
those modes before creating a fixture or container. These are helper restrictions, not an image compatibility claim; use
application-specific mount ownership when running images with remapped UIDs. Do not change daemon configuration just to
run the helper. The helper uses a temporary dependency-free fixture, the host UID:GID, an exclusive container ID, and
dynamically allocated loopback HTTP/HTTPS ports. It checks application output, effective FPM memory settings, HTTPS, the
internal health command, blocked external access to /__health, CLI execution, expected tools, and host file ownership.
It removes its own container and fixture on success or failure, preserving images and all unrelated resources. It does
not run Composer scripts or application migrations.
The helper uses a private :Z bind label for its disposable fixture so Docker can relabel it on SELinux hosts. Only the
newly created fixture is relabeled; do not apply this option to system directories or shared application checkouts. See
Docker’s SELinux bind-mount guidance.
Local image builds use the public image targets:
docker buildx bake image-8-5-dev --loadbash skills/yii2-docker-environment/scripts/validate.sh ghcr.io/yii2-extensions/apache:8.5-debian-devThe CI build workflow builds images; maintainer regression tests are private and run separately. Image builds may
download dependencies. Avoid the digest-* Bake targets for local validation: they push to the registry.
Test an application
Section titled “Test an application”Install the application’s locked dependencies, including its development tools, before running its own test command. The
image does not include PHPUnit, Codeception, a database server or a default test suite. From the quick-start container,
when the application actually defines the tests Composer script:
docker exec -e COMPOSER_HOME=/tmp/app-composer app composer install --no-interaction --prefer-distdocker exec app composer run testsFor an application with PHPUnit installed at vendor/bin/phpunit, use dev or full for Xdebug coverage:
docker exec -e XDEBUG_MODE=coverage app php vendor/bin/phpunit --coverage-textXDEBUG_MODE=off avoids debugger overhead for ordinary test runs. Configure dedicated test database credentials and
application state before tests that write data. YII_ENV=test enables entrypoint service waiting and skips startup
migrations; it does not select or isolate a database for your test suite.
Record the image tag/digest, architecture, user, commands, assertions and any skipped checks. Read configuration when web and CLI PHP settings differ, and agent setup for skill installation and activation checks.