Skip to content

Commit be8f9a3

Browse files
committed
update readme
1 parent 92bdc53 commit be8f9a3

File tree

3 files changed

+144
-92
lines changed

3 files changed

+144
-92
lines changed

README.md

Lines changed: 97 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,154 +1,160 @@
1-
# UDX Worker PHP
2-
3-
[![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)
1+
<img src="assets/logo.svg" alt="UDX Worker PHP">
42

5-
**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.**
3+
# UDX Worker PHP
64

7-
[Quick Start](#-quick-start)[Development](#-development)[Deployment](#-deployment)[Contributing](#-contributing)
5+
[![Docker Pulls](https://img.shields.io/docker/pulls/usabilitydynamics/udx-worker-php.svg)](https://hub.docker.com/r/usabilitydynamics/udx-worker-php)
6+
[![License](https://img.shields.io/github/license/udx/worker-php.svg)](LICENSE)
87

9-
## 🚀 Overview
8+
PHP runtime image built on UDX Worker with NGINX + PHP-FPM preconfigured.
109

11-
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.
10+
[Quick Start](#quick-start)[Usage](#usage)[Development](#development)[Resources](#resources)
1211

13-
### 🔧 Based on udx-worker
12+
## Overview
1413

15-
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.
14+
`udx-worker-php` extends [`udx/worker`](https://github.com/udx/worker) and keeps the same worker runtime model while adding:
1615

17-
## 👨‍💻 Development
16+
- NGINX configured for `/var/www`
17+
- PHP-FPM (`8.4`) with socket-based NGINX integration
18+
- Worker service definitions that autostart both `php-fpm` and `nginx`
1819

19-
### 📋 Prerequisites
20+
This image is intended as a base runtime for PHP applications and PHP-focused automation workloads.
2021

21-
- Ensure `Docker` is installed and running on your system.
22+
## Quick Start
2223

23-
### 🚀 Quick Start
24+
Requirements: Docker (and Make if you want local dev commands).
2425

25-
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.
26+
### Run from Docker Hub
2627

27-
### Running Built-In Tests
28+
```bash
29+
docker run -d \
30+
--name my-php-app \
31+
-p 80:80 \
32+
-v "$(pwd)/my-php-app:/var/www" \
33+
usabilitydynamics/udx-worker-php:latest
34+
```
2835

29-
1. Clone this repository:
36+
Then open `http://localhost` (or your mapped host port).
3037

31-
```
32-
git clone https://github.com/udx/udx-worker-php.git
33-
cd udx-worker-php
34-
```
38+
### Local Development Workflow
3539

36-
2. Build the Docker image:
40+
```bash
41+
git clone https://github.com/udx/worker-php.git
42+
cd worker-php
3743

38-
```
3944
make build
45+
make run
46+
make log FOLLOW_LOGS=true
4047
```
4148

42-
3. Run Tests to verify functionality:
43-
44-
```
45-
make run-all-tests
46-
```
49+
`make run` uses these defaults from `Makefile.variables`:
4750

48-
You can add additional tests in the `src/tests/` directory as needed.
51+
- volume: `./src/scripts:/var/www`
52+
- host/container port: `80:80`
53+
- env file: `.env`
4954

50-
## 🚀 Deployment
55+
## Usage
5156

52-
### Deploying Using the Pre-Built Image
57+
### Mount your own app code
5358

54-
If you want to use the pre-built image directly from Docker Hub without cloning the repository:
59+
```bash
60+
make run VOLUMES="$(pwd)/path-to-app:/var/www" HOST_PORT=8080
61+
```
5562

56-
1. Pull the Image:
63+
### Run interactively
5764

58-
```
59-
docker pull usabilitydynamics/udx-worker-php:latest
65+
```bash
66+
make run-it
6067
```
6168

62-
2. Run the container with your application code:
69+
### Execute into the running container
6370

64-
```
65-
docker run -d --name my-php-app \
66-
-v $(pwd)/my-php-app:/var/www \
67-
-p 80:80 \
68-
usabilitydynamics/udx-worker-php:latest
71+
```bash
72+
make exec
6973
```
7074

71-
This serves your application at http://localhost.
75+
### Deploy with Worker CLI config
7276

73-
3. Stop and remove the container when done:
77+
This repo includes a sample `deploy.yml` for [`@udx/worker-deployment`](https://www.npmjs.com/package/@udx/worker-deployment).
7478

79+
```bash
80+
npm install -g @udx/worker-deployment
81+
worker run
7582
```
76-
docker rm -f my-php-app
77-
```
78-
79-
### Deploying Using a Locally Built Image (Makefile Approach)
8083

81-
If you’ve cloned this repository and built the image locally, you can use the provided Makefile targets:
84+
## Testing
8285

83-
1. Build the Image (if not already built):
86+
Run all built-in tests:
8487

85-
```
86-
make build
88+
```bash
89+
make run-all-tests
8790
```
8891

89-
2. Run the Container:
92+
Run full validation (build + tests):
9093

94+
```bash
95+
make test
9196
```
92-
make run
93-
```
94-
95-
By default, this command runs the container with the code located in the `src/` directory of this repository.
9697

97-
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:
98+
Run a specific test script:
9899

99-
```
100-
APP_PATH=/path/to/your-php-app make run
100+
```bash
101+
make run-test TEST_SCRIPT=10_nginx_test.php
101102
```
102103

103-
- Replace `/path/to/your-php-app` with the path to your PHP application directory.
104-
- This command will mount your specified application directory into the container’s `/var/www` directory, allowing you to run your custom application directly.
104+
Current tests live in `src/tests/` and cover:
105105

106-
## ⚙️ Configuration
106+
- NGINX HTTP response
107+
- PHP runtime availability
108+
- CLI execution
109+
- write permissions under `/var/www`
107110

108-
You can configure build and runtime variables in `Makefile.variables`:
111+
## Configuration
109112

110-
- PHP and NGINX versions. _(Only PHP8.4 supported for now)_
111-
- Port mappings
112-
- Source paths
113+
Primary defaults are in `Makefile.variables`:
113114

114-
Adjust these variables to suit your environment or specific deployment requirements.
115+
- `DOCKER_IMAGE`
116+
- `CONTAINER_NAME`
117+
- `HOST_PORT` / `CONTAINER_PORT`
118+
- `VOLUMES`
119+
- `PHP_VERSION`
115120

116-
## 🛠️ Makefile Commands Helper
121+
Container/runtime config files:
117122

118-
Use make to view all available commands:
123+
- `etc/configs/nginx/default.conf`
124+
- `etc/configs/php/php-fpm.conf`
125+
- `etc/configs/php/www.conf`
126+
- `etc/configs/worker/services.yaml`
119127

120-
```
128+
## Development
129+
130+
Useful commands:
131+
132+
```bash
121133
make help
134+
make build
135+
make run
136+
make log
137+
make clean
138+
make test
122139
```
123140

124-
These commands offer options for building, running, and testing your application seamlessly.
141+
## Resources
142+
143+
- Docker Hub: https://hub.docker.com/r/usabilitydynamics/udx-worker-php
144+
- Source: https://github.com/udx/worker-php
145+
- Base runtime docs: https://github.com/udx/worker/tree/latest/docs
146+
- Deployment config docs: https://github.com/udx/worker-deployment/blob/latest/docs/deploy-config.md
125147

126-
## 🤝 Contributing
127-
We welcome contributions! Here's how you can help:
148+
## Contributing
128149

129150
1. Fork the repository
130151
2. Create a feature branch
131152
3. Commit your changes
132153
4. Push to your branch
133-
5. Open a Pull Request
134-
135-
Please ensure your PR:
136-
- Follows our coding standards
137-
- Includes appropriate tests
138-
- Updates relevant documentation
139-
140-
## 🔗 Resources
141-
- [Docker Hub](https://hub.docker.com/r/usabilitydynamics/udx-worker-php)
142-
- [Product Page](https://udx.io/products/udx-worker-php)
154+
5. Open a pull request
143155

144-
## 🎯 Custom Development
145-
Need specific features or customizations?
146-
[Contact our team](https://udx.io/) for professional development services.
156+
Include relevant tests and documentation updates with your changes.
147157

148-
## 📄 License
149-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
158+
## License
150159

151-
---
152-
<div align="center">
153-
Built by <a href="https://udx.io">UDX</a> © 2025
154-
</div>
160+
MIT. See [`LICENSE`](LICENSE).

0 commit comments

Comments
 (0)