From 297211c27a64af3f7c80377e13ab4693ac16e903 Mon Sep 17 00:00:00 2001 From: Dmitry Smirnov Date: Fri, 13 Feb 2026 18:51:55 +0300 Subject: [PATCH 1/5] upgrade docker dependencies --- Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7caa9d5..98a3544 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,14 @@ # Use the UDX worker as the base image -FROM usabilitydynamics/udx-worker:0.35.0 +FROM usabilitydynamics/udx-worker:0.38.0 # Add metadata labels LABEL maintainer="UDX" -LABEL version="0.30.0" +LABEL version="0.31.0" # Arguments and Environment Variables ARG PHP_VERSION=8.4 -ARG PHP_PACKAGE_VERSION=8.4.11-1ubuntu1 -ARG NGINX_VERSION=1.28.0-6ubuntu1 +ARG PHP_PACKAGE_VERSION=8.4.11-1ubuntu1.1 +ARG NGINX_VERSION=1.28.0-6ubuntu1.1 # Set the PHP_VERSION and PHP_PACKAGE_VERSION as environment variables ENV PHP_VERSION="${PHP_VERSION}" @@ -28,7 +28,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ php"${PHP_VERSION}"-curl="${PHP_PACKAGE_VERSION}" \ php"${PHP_VERSION}"-xml="${PHP_PACKAGE_VERSION}" \ php"${PHP_VERSION}"-zip="${PHP_PACKAGE_VERSION}" \ - mysql-client=8.4.7-0ubuntu0.25.10.2 && \ + mysql-client=8.4.8-0ubuntu0.25.10.1 && \ apt-get clean && \ rm -rf /tmp/* /var/tmp/* && \ mkdir -p /etc/apt/sources.list.d && \ From 31a6151ac0101a5fcf2a15f6fdee6e616aa0c3c3 Mon Sep 17 00:00:00 2001 From: Dmitry Smirnov Date: Fri, 13 Feb 2026 18:55:27 +0300 Subject: [PATCH 2/5] enabled docker-ops --- .github/workflows/docker-ops.yml | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/docker-ops.yml diff --git a/.github/workflows/docker-ops.yml b/.github/workflows/docker-ops.yml new file mode 100644 index 0000000..ae57888 --- /dev/null +++ b/.github/workflows/docker-ops.yml @@ -0,0 +1,34 @@ +--- +name: Docker Operations + +"on": + push: + paths: + - ".github/workflows/docker-ops.yml" + - "bin/**" + - "Dockerfile" + - "etc/**" + - "ci/**" + - "src/**" + - LICENSE + workflow_dispatch: + +jobs: + docker_ops: + permissions: + id-token: write + contents: write + security-events: write + actions: read + + uses: udx/reusable-workflows/.github/workflows/docker-ops.yml@master + with: + image_name: worker-php + release_branch: latest + docker_login: ${{ vars.DOCKER_LOGIN }} + docker_org: ${{ vars.DOCKER_ORG }} + docker_repo: ${{ vars.DOCKER_REPO }} + enable_security_upload: ${{ github.repository == 'udx/worker-php' }} + + secrets: + docker_token: ${{ secrets.DOCKER_TOKEN }} From 96b4aeb8a5f5911ba252b3e1ffe2e5ee81232104 Mon Sep 17 00:00:00 2001 From: Dmitry Smirnov Date: Fri, 13 Feb 2026 18:57:18 +0300 Subject: [PATCH 3/5] remove legacy release workflow --- .github/workflows/build-and-test.yml | 98 ----------------- .github/workflows/release.yml | 157 --------------------------- .github/workflows/tests.yml | 21 ++++ 3 files changed, 21 insertions(+), 255 deletions(-) delete mode 100644 .github/workflows/build-and-test.yml delete mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml deleted file mode 100644 index 1274533..0000000 --- a/.github/workflows/build-and-test.yml +++ /dev/null @@ -1,98 +0,0 @@ ---- -name: Build and Test Docker Image - -"on": - push: - branches-ignore: - - latest - paths: - - ".github/workflows/build-and-test.yml" - - "Dockerfile" - - "bin/**" - - "src/**" - - LICENSE - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: write - - steps: - - name: Checkout code - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Run Development Pipeline - run: make dev-pipeline - working-directory: . - - - name: Install Trivy - run: | - curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | \ - sudo sh -s -- -b /usr/local/bin - - - name: Trivy Vulnerability Scanning - run: | - export TRIVY_DISABLE_VEX_NOTICE=true - - # Disable exit on error for the retry logic - set +e - - # Retry logic for Trivy - max_retries=5 - attempt=1 - success=false - - while [ $attempt -le $max_retries ]; do - echo "Running Trivy scan, attempt $attempt..." - - # Run the Trivy scan and capture the exit status - trivy image --severity CRITICAL --exit-code 1 --quiet \ - usabilitydynamics/udx-worker-php:latest | tee trivy.log | grep -v 'INFO' - scan_exit_code=$? - - # Check if CRITICAL vulnerabilities were detected - if grep -E "Total: [1-9]" trivy.log; then - echo "CRITICAL vulnerabilities detected! Exiting." - exit 1 - fi - - # Handle a successful scan (no critical vulnerabilities found) - if [ $scan_exit_code -eq 0 ]; then - echo "No CRITICAL vulnerabilities found." - success=true - break - else - echo "Trivy scan encountered an error, retrying in 2 minutes..." - sleep 120 - attempt=$((attempt+1)) - fi - done - - # Exit if all retries fail without a successful scan - if [ "$success" = false ]; then - echo "Failed to complete Trivy scan after $max_retries attempts." - exit 1 - fi - - - name: Trivy SBOM Generation - run: | - export TRIVY_DISABLE_VEX_NOTICE=true - trivy image --format spdx-json --output sbom.json usabilitydynamics/udx-worker-php:latest 2>/dev/null - - echo "SBOM Top Packages Summary:" - echo "| Package Name | Version |" - echo "|-------------------|-----------|" - - jq -r '.packages[] | select(.versionInfo != null) | "\(.name) | \(.versionInfo)"' sbom.json | sort | uniq | head -n 20 | column -t -s '|' - - - name: Upload SBOM Artifact - uses: actions/upload-artifact@v5 - with: - name: sbom - path: sbom.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 90111d0..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,157 +0,0 @@ ---- -name: Release - -"on": - push: - branches: - - "latest" - paths: - - '.github/workflows/release.yml' - - 'Dockerfile' - - 'bin/**' - - 'ci/**' - - 'src/**' - - LICENSE - -jobs: - docker-release: - runs-on: ubuntu-latest - permissions: - id-token: write - contents: write - - outputs: - semVer: ${{ steps.gitversion.outputs.semVer }} - changelog: ${{ steps.changelog.outputs.changelog }} - - steps: - - name: Checkout code - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver: docker-container - - - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v4.1.0 - with: - versionSpec: "6.1.0" - - - name: Clear GitVersion Cache - run: rm -rf .git/gitversion_cache - - - name: Determine Version - id: gitversion - uses: gittools/actions/gitversion/execute@v4.1.0 - with: - useConfigFile: true - configFilePath: ci/git-version.yml - - - name: Generate Changelog - id: changelog - run: | - git log $(git describe --tags --abbrev=0)..HEAD -- . \ - --pretty=format:"- %s" > changelog.txt - CHANGELOG=$(cat changelog.txt | jq -sRr @uri) - echo "changelog<> $GITHUB_ENV - echo "$CHANGELOG" >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: "usabilitydynamics" - password: ${{ secrets.DOCKER_TOKEN }} - - - name: Build and Push Docker Image - id: docker_push - uses: docker/build-push-action@v6 - with: - context: . - platforms: linux/amd64, linux/arm64 - push: true - sbom: true - provenance: true - tags: | - usabilitydynamics/udx-worker-php:${{ steps.gitversion.outputs.semVer }} - usabilitydynamics/udx-worker-php:latest - - - name: Install Trivy - run: | - curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | \ - sudo sh -s -- -b /usr/local/bin - - - name: Generate SBOM with Retry Logic - id: generate-sbom - run: | - export TRIVY_DISABLE_VEX_NOTICE=true - max_retries=10 - attempt=1 - success=false - while [ $attempt -le $max_retries ]; do - echo "Generating SBOM, attempt $attempt..." - output=$(trivy image --format spdx-json --output sbom.json usabilitydynamics/udx-worker-php:${{ steps.gitversion.outputs.semVer }} 2>&1) - sbom_exit_code=$? - if [ $sbom_exit_code -eq 0 ]; then - echo "SBOM generation successful." - success=true - break - else - echo "Retrying in 120 seconds..." - sleep 120 - attempt=$((attempt+1)) - fi - done - if [ "$success" = false ]; then - exit 1 - fi - - - name: Upload SBOM Artifact - uses: actions/upload-artifact@v5 - with: - name: sbom - path: sbom.json - - - name: Log out from Docker Hub - run: docker logout - - github-release: - runs-on: ubuntu-latest - needs: docker-release - permissions: - contents: write - - steps: - - name: Checkout code - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Configure Git for Pushing - run: | - git config --global user.email "worker@udx.io" - git config --global user.name "UDX Worker PHP" - - - name: Download SBOM Artifact - uses: actions/download-artifact@v6 - with: - name: sbom - - - name: Create GitHub Release - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ needs.docker-release.outputs.semVer }} - body: | - Release version ${{ needs.docker-release.outputs.semVer }}. - [View on Docker Hub](https://hub.docker.com/r/usabilitydynamics/udx-worker-php/tags?page=1&ordering=last_updated). - ${{ needs.docker-release.outputs.changelog }} - draft: false - prerelease: false - files: sbom.json - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..08cba37 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,21 @@ +--- +name: Tests + +on: + push: + pull_request: + +permissions: + contents: read + +jobs: + test: + name: Build and Test + runs-on: ubuntu-24.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Build and test + run: make test From 92bdc53a5348d2f336c244298c61eaa99a80814c Mon Sep 17 00:00:00 2001 From: Dmitry Smirnov Date: Fri, 13 Feb 2026 19:10:37 +0300 Subject: [PATCH 4/5] added context7.json --- context7.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 context7.json diff --git a/context7.json b/context7.json new file mode 100644 index 0000000..874b3d2 --- /dev/null +++ b/context7.json @@ -0,0 +1,4 @@ +{ + "url": "https://context7.com/udx/worker-php", + "public_key": "pk_tqqni3hp1kYeoqIpnEaIp" +} From be8f9a3ec7d81a4db2a89cd31faaa65713a242af Mon Sep 17 00:00:00 2001 From: Dmitry Smirnov Date: Fri, 13 Feb 2026 19:46:49 +0300 Subject: [PATCH 5/5] update readme --- README.md | 188 +++++++++++++++++++++++++----------------------- assets/logo.svg | 46 ++++++++++++ deploy.yml | 2 +- 3 files changed, 144 insertions(+), 92 deletions(-) create mode 100644 assets/logo.svg diff --git a/README.md b/README.md index c289f52..3059359 100644 --- a/README.md +++ b/README.md @@ -1,154 +1,160 @@ -# UDX Worker PHP - -[![Docker Pulls](https://img.shields.io/docker/pulls/usabilitydynamics/udx-worker-php.svg)](https://hub.docker.com/r/usabilitydynamics/udx-worker-php) [![License](https://img.shields.io/github/license/udx/worker-php.svg)](LICENSE) +UDX Worker PHP -**A versatile Docker image for running PHP applications with NGINX and PHP-FPM, providing a ready-to-use environment to deploy and serve your PHP projects.** +# UDX Worker PHP -[Quick Start](#-quick-start) β€’ [Development](#-development) β€’ [Deployment](#-deployment) β€’ [Contributing](#-contributing) +[![Docker Pulls](https://img.shields.io/docker/pulls/usabilitydynamics/udx-worker-php.svg)](https://hub.docker.com/r/usabilitydynamics/udx-worker-php) +[![License](https://img.shields.io/github/license/udx/worker-php.svg)](LICENSE) -## πŸš€ Overview +PHP runtime image built on UDX Worker with NGINX + PHP-FPM preconfigured. -The image is designed as a general-purpose base for PHP application development and deployment. It includes essential configurations for NGINX and PHP-FPM to streamline your setup, making it easy to get started with popular frameworks and custom applications alike. +[Quick Start](#quick-start) β€’ [Usage](#usage) β€’ [Development](#development) β€’ [Resources](#resources) -### πŸ”§ Based on udx-worker +## Overview -Built on [`udx-worker`](https://github.com/udx/worker), this image benefits from secure, resource-efficient configurations and best practices, providing a reliable foundation for PHP applications. +`udx-worker-php` extends [`udx/worker`](https://github.com/udx/worker) and keeps the same worker runtime model while adding: -## πŸ‘¨β€πŸ’» Development +- NGINX configured for `/var/www` +- PHP-FPM (`8.4`) with socket-based NGINX integration +- Worker service definitions that autostart both `php-fpm` and `nginx` -### πŸ“‹ Prerequisites +This image is intended as a base runtime for PHP applications and PHP-focused automation workloads. -- Ensure `Docker` is installed and running on your system. +## Quick Start -### πŸš€ Quick Start +Requirements: Docker (and Make if you want local dev commands). -This image serves as a base for your PHP applications. The `src/tests/` directory includes sample tests for verifying PHP and NGINX functionality, but it does not contain application code by default. +### Run from Docker Hub -### Running Built-In Tests +```bash +docker run -d \ + --name my-php-app \ + -p 80:80 \ + -v "$(pwd)/my-php-app:/var/www" \ + usabilitydynamics/udx-worker-php:latest +``` -1. Clone this repository: +Then open `http://localhost` (or your mapped host port). -``` -git clone https://github.com/udx/udx-worker-php.git -cd udx-worker-php -``` +### Local Development Workflow -2. Build the Docker image: +```bash +git clone https://github.com/udx/worker-php.git +cd worker-php -``` make build +make run +make log FOLLOW_LOGS=true ``` -3. Run Tests to verify functionality: - -``` -make run-all-tests -``` +`make run` uses these defaults from `Makefile.variables`: -You can add additional tests in the `src/tests/` directory as needed. +- volume: `./src/scripts:/var/www` +- host/container port: `80:80` +- env file: `.env` -## πŸš€ Deployment +## Usage -### Deploying Using the Pre-Built Image +### Mount your own app code -If you want to use the pre-built image directly from Docker Hub without cloning the repository: +```bash +make run VOLUMES="$(pwd)/path-to-app:/var/www" HOST_PORT=8080 +``` -1. Pull the Image: +### Run interactively -``` -docker pull usabilitydynamics/udx-worker-php:latest +```bash +make run-it ``` -2. Run the container with your application code: +### Execute into the running container -``` -docker run -d --name my-php-app \ - -v $(pwd)/my-php-app:/var/www \ - -p 80:80 \ - usabilitydynamics/udx-worker-php:latest +```bash +make exec ``` -This serves your application at http://localhost. +### Deploy with Worker CLI config -3. Stop and remove the container when done: +This repo includes a sample `deploy.yml` for [`@udx/worker-deployment`](https://www.npmjs.com/package/@udx/worker-deployment). +```bash +npm install -g @udx/worker-deployment +worker run ``` -docker rm -f my-php-app -``` - -### Deploying Using a Locally Built Image (Makefile Approach) -If you’ve cloned this repository and built the image locally, you can use the provided Makefile targets: +## Testing -1. Build the Image (if not already built): +Run all built-in tests: -``` -make build +```bash +make run-all-tests ``` -2. Run the Container: +Run full validation (build + tests): +```bash +make test ``` -make run -``` - -By default, this command runs the container with the code located in the `src/` directory of this repository. -3. Deploy Application Code. If your PHP application code is located in a different directory or repository, use the deploy target to mount it as a volume: +Run a specific test script: -``` -APP_PATH=/path/to/your-php-app make run +```bash +make run-test TEST_SCRIPT=10_nginx_test.php ``` -- Replace `/path/to/your-php-app` with the path to your PHP application directory. -- This command will mount your specified application directory into the container’s `/var/www` directory, allowing you to run your custom application directly. +Current tests live in `src/tests/` and cover: -## βš™οΈ Configuration +- NGINX HTTP response +- PHP runtime availability +- CLI execution +- write permissions under `/var/www` -You can configure build and runtime variables in `Makefile.variables`: +## Configuration -- PHP and NGINX versions. _(Only PHP8.4 supported for now)_ -- Port mappings -- Source paths +Primary defaults are in `Makefile.variables`: -Adjust these variables to suit your environment or specific deployment requirements. +- `DOCKER_IMAGE` +- `CONTAINER_NAME` +- `HOST_PORT` / `CONTAINER_PORT` +- `VOLUMES` +- `PHP_VERSION` -## πŸ› οΈ Makefile Commands Helper +Container/runtime config files: -Use make to view all available commands: +- `etc/configs/nginx/default.conf` +- `etc/configs/php/php-fpm.conf` +- `etc/configs/php/www.conf` +- `etc/configs/worker/services.yaml` -``` +## Development + +Useful commands: + +```bash make help +make build +make run +make log +make clean +make test ``` -These commands offer options for building, running, and testing your application seamlessly. +## Resources + +- Docker Hub: https://hub.docker.com/r/usabilitydynamics/udx-worker-php +- Source: https://github.com/udx/worker-php +- Base runtime docs: https://github.com/udx/worker/tree/latest/docs +- Deployment config docs: https://github.com/udx/worker-deployment/blob/latest/docs/deploy-config.md -## 🀝 Contributing -We welcome contributions! Here's how you can help: +## Contributing 1. Fork the repository 2. Create a feature branch 3. Commit your changes 4. Push to your branch -5. Open a Pull Request - -Please ensure your PR: -- Follows our coding standards -- Includes appropriate tests -- Updates relevant documentation - -## πŸ”— Resources -- [Docker Hub](https://hub.docker.com/r/usabilitydynamics/udx-worker-php) -- [Product Page](https://udx.io/products/udx-worker-php) +5. Open a pull request -## 🎯 Custom Development -Need specific features or customizations? -[Contact our team](https://udx.io/) for professional development services. +Include relevant tests and documentation updates with your changes. -## πŸ“„ License -This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. +## License ---- -
-Built by UDX Β© 2025 -
\ No newline at end of file +MIT. See [`LICENSE`](LICENSE). diff --git a/assets/logo.svg b/assets/logo.svg new file mode 100644 index 0000000..e9b9a0a --- /dev/null +++ b/assets/logo.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/deploy.yml b/deploy.yml index 3a3e43b..ef48818 100644 --- a/deploy.yml +++ b/deploy.yml @@ -1,7 +1,7 @@ # npm install -g @udx/worker-deployment # gcloud auth login # gcloud auth application-default login -# worker-run +# worker run --- kind: workerDeployConfig