|
1 | | -# Docker LAMP Stack |
| 1 | +```markdown |
| 2 | +# 🚀 Docker LAMPP Stack |
2 | 3 |
|
3 | | -A flexible and robust LAMP (Linux, Apache, MySQL/MariaDB, PHP) stack Docker image with additional tools like Redis, Python, Node.js, and Composer. This project supports configurable PHP and phpMyAdmin versions, managed by Supervisor for process reliability. |
| 4 | + |
| 5 | + |
| 6 | + |
4 | 7 |
|
5 | | -## Features |
6 | | -- **Base:** Ubuntu 24.04 |
7 | | -- **Web Server:** Apache 2 |
8 | | -- **Database:** MariaDB |
9 | | -- **PHP:** Configurable version (default: 7.4) with essential and optional extensions |
10 | | -- **phpMyAdmin:** Configurable version (default: 5.1.1) with fallback to 5.2.1 |
11 | | -- **Extras:** Redis, Python 3, Node.js 18.x, Composer |
12 | | -- **Process Management:** Supervisor |
13 | | -- **Persistence:** Volumes for MySQL, application data, and logs |
14 | | -- **Ports:** 80 (Apache), 3306 (MariaDB), 6379 (Redis), with optional additional ports |
| 8 | +Welcome to the **Docker LAMPP Stack** repository! This project provides a flexible and powerful environment for web development, combining Linux, Apache, MariaDB, and PHP with Docker on Ubuntu 24.04 LTS. |
15 | 9 |
|
16 | | -## Requirements |
17 | | -- Docker installed on your system |
| 10 | +## 🌟 Features |
18 | 11 |
|
19 | | -## Usage |
| 12 | +- **Multi-PHP Version Support**: Choose between PHP 7.4, 8.0, 8.1, and 8.3 to meet your project needs. |
| 13 | +- **Full Stack**: Includes Apache, MariaDB, and additional tools like Redis, Composer, Node.js, phpMyAdmin, and Adminer. |
| 14 | +- **Ease of Use**: Set up your development environment quickly and efficiently using Docker. |
| 15 | +- **Customizable**: Easily modify configurations to suit your project requirements. |
20 | 16 |
|
21 | | -# Docker LAMP Stack |
| 17 | +## 🛠️ Technologies Used |
22 | 18 |
|
23 | | -A flexible and robust LAMP (Linux, Apache, MySQL/MariaDB, PHP) stack Docker image with additional tools like Redis, Python, Node.js, and Composer. This project supports configurable PHP and phpMyAdmin versions, managed by Supervisor for process reliability. |
| 19 | +- **Linux**: The base operating system, providing a reliable environment. |
| 20 | +- **Apache**: The web server for serving your applications. |
| 21 | +- **MariaDB**: A powerful database management system for storing data. |
| 22 | +- **PHP**: The server-side scripting language for dynamic content. |
| 23 | +- **Redis**: A fast in-memory data structure store. |
| 24 | +- **Composer**: Dependency manager for PHP. |
| 25 | +- **Node.js**: JavaScript runtime for server-side scripting. |
| 26 | +- **phpMyAdmin**: A web interface for managing MySQL/MariaDB databases. |
| 27 | +- **Adminer**: An alternative lightweight database management tool. |
24 | 28 |
|
25 | | -## Features |
26 | | -- **Base:** Ubuntu 24.04 |
27 | | -- **Web Server:** Apache 2 |
28 | | -- **Database:** MariaDB |
29 | | -- **PHP:** Configurable version (default: 7.4) with essential and optional extensions |
30 | | -- **phpMyAdmin:** Configurable version (default: 5.1.1) with fallback to 5.2.1 |
31 | | -- **Extras:** Redis, Python 3, Node.js 18.x, Composer |
32 | | -- **Process Management:** Supervisor |
33 | | -- **Persistence:** Volumes for MySQL, application data, and logs |
34 | | -- **Ports:** 80 (Apache), 3306 (MariaDB), 6379 (Redis), with optional additional ports |
| 29 | +## 🔗 Quick Start Guide |
35 | 30 |
|
36 | | -## Requirements |
37 | | -- Docker installed on your system |
| 31 | +### Prerequisites |
38 | 32 |
|
39 | | -## Usage |
| 33 | +Ensure you have Docker and Docker Compose installed on your machine. If not, you can download them from the official Docker website. |
| 34 | + |
| 35 | +### Installation |
| 36 | + |
| 37 | +1. Clone the repository: |
| 38 | + |
| 39 | + ```bash |
| 40 | + git clone https://github.com/FineG21/docker-lampp-stack.git |
| 41 | + cd docker-lampp-stack |
| 42 | + ``` |
| 43 | + |
| 44 | +2. Start the LAMPP stack: |
40 | 45 |
|
41 | | -### Build the Image |
42 | | -1. Clone or download this repository: |
43 | 46 | ```bash |
44 | | - git clone https://github.com/syspanel/docker-lamp-stack.git |
45 | | - cd docker-lamp-stack |
46 | | - |
47 | | - Build the Docker image with specific PHP and phpMyAdmin versions: |
48 | | - PHP 7.4 with phpMyAdmin 5.1.1 (default): |
49 | | - bash |
50 | | - |
51 | | - docker build -t docker-lamp-stack . |
52 | | - |
53 | | - PHP 7.4 with phpMyAdmin 5.1.1: |
54 | | - bash |
55 | | - docker build -t docker-lamp-stack-74 --build-arg PHP_VERSION=7.4 --build-arg PHPMYADMIN_VERSION=5.1.1 . |
56 | | - PHP 8.0 with phpMyAdmin 5.2.1: |
57 | | - bash |
58 | | - docker build -t docker-lamp-stack-80 --build-arg PHP_VERSION=8.0 --build-arg PHPMYADMIN_VERSION=5.2.1 . |
59 | | - PHP 8.1 with phpMyAdmin 5.2.1: |
60 | | - bash |
61 | | - docker build -t docker-lamp-stack-81 --build-arg PHP_VERSION=8.1 --build-arg PHPMYADMIN_VERSION=5.2.1 . |
62 | | - PHP 8.2 with phpMyAdmin 5.2.1: |
63 | | - bash |
64 | | - docker build -t docker-lamp-stack-82 --build-arg PHP_VERSION=8.2 --build-arg PHPMYADMIN_VERSION=5.2.1 . |
65 | | - PHP 8.3 with phpMyAdmin 5.2.1: |
66 | | - bash |
67 | | - docker build -t docker-lamp-stack-83 --build-arg PHP_VERSION=8.3 --build-arg PHPMYADMIN_VERSION=5.2.1 . |
68 | | - Note: If the specified PHPMYADMIN_VERSION is unavailable, it falls back to 5.2.1. |
69 | | - |
70 | | -Run the Container |
71 | | - |
72 | | -Run the container with persistent volumes for the application, MySQL data, and logs. Below is an example with additional ports and log mapping: |
73 | | - bash |
74 | | - |
75 | | - docker run --name "docker-lamp-stack" \ |
76 | | - -p "8080:80" -p "8082:3306" -p "8083:6379" \ |
77 | | - -v ${PWD}/app:/app -v ${PWD}/mysql:/var/lib/mysql \ |
78 | | - -v ${PWD}/logs:/var/log \ |
79 | | - docker-lamp-stack-74 |
80 | | - |
81 | | -Basic Example (without additional ports or logs): |
82 | | - bash |
83 | | - |
84 | | - docker run --name "docker-lamp-stack" \ |
85 | | - -p "8080:80" -p "8082:3306" -p "8083:6379" \ |
86 | | - -v ${PWD}/app:/app -v ${PWD}/mysql:/var/lib/mysql \ |
87 | | - docker-lamp-stack |
88 | | - |
89 | | -Access |
90 | | - |
91 | | - Web Server: http://localhost:16080 (or 8080 for basic example; displays "Server running! PHP x.x.x") |
92 | | - phpMyAdmin: http://localhost:16080/phpmyadmin (or 8080; user: root, password: root) |
93 | | - MariaDB: Port 16082 (or 8082), user: root, password: root |
94 | | - Redis: Port 16083 (or 8083) |
95 | | - Additional Ports: 16081 (443), 16084 (8000), 16085 (9000), 16086 (10000) are mappable but require additional configuration for use (e.g., SSL for 443). |
96 | | - |
97 | | -Logs |
98 | | - |
99 | | -Logs are available in the /var/log directory inside the container. With the -v ${PWD}/logs:/var/log volume, they are persisted to the logs directory on the host: |
100 | | - |
101 | | - Apache: ${PWD}/logs/apache2/supervisor.log |
102 | | - MariaDB: ${PWD}/logs/mariadb/supervisor.log, ${PWD}/logs/mariadb/error.log |
103 | | - Redis: ${PWD}/logs/redis/supervisor.log |
104 | | - Supervisor: ${PWD}/logs/supervisor/supervisord.log |
105 | | - |
106 | | -Configuration |
107 | | - |
108 | | -Configuration files are located in the config/ directory: |
109 | | - |
110 | | - Apache: config/apache/000-default.conf |
111 | | - PHP: config/php/apache2-php.ini and config/php/cli-php.ini |
112 | | - MariaDB: config/mariadb/custom.cnf |
113 | | - Redis: config/redis/redis.conf |
114 | | - Supervisor: config/supervisor/ (main config and service-specific files) |
115 | | - Startup Script: config/start.sh (initializes MariaDB and creates log directories) |
116 | | - |
117 | | -Supported PHP Versions |
118 | | - |
119 | | -Any version available in the ppa:ondrej/php repository (e.g., 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3). Optional extensions are installed if available; missing ones are skipped without failing the build. |
120 | | -phpMyAdmin Fallback |
121 | | - |
122 | | -If the specified PHPMYADMIN_VERSION is not found, the build automatically falls back to version 5.2.1, ensuring compatibility with modern PHP versions. |
123 | | -Repository |
124 | | - |
125 | | -This project is hosted on GitHub: syspanel/docker-lamp-stack |
126 | | -License |
127 | | - |
128 | | -This project is licensed under the MIT License. See the file for details. |
129 | | -Author |
130 | | - |
131 | | -Marco Costa marcocosta@gmx.com |
132 | | -Support the Project |
133 | | - |
134 | | -### Support the Project |
135 | | -If you find this project useful, consider supporting its development with a donation via PayPal: |
136 | | - |
137 | | -[](https://www.paypal.com/donate/?business=marcocosta@gmx.com¤cy_code=USD) |
| 47 | + docker-compose up -d |
| 48 | + ``` |
| 49 | + |
| 50 | +3. Access your applications: |
| 51 | + - Visit `http://localhost` for your PHP application. |
| 52 | + - Access phpMyAdmin at `http://localhost:8080`. |
| 53 | + - Access Adminer at `http://localhost:8081`. |
| 54 | + |
| 55 | +### Stopping the Stack |
| 56 | + |
| 57 | +To stop the running containers, use: |
| 58 | + |
| 59 | +```bash |
| 60 | +docker-compose down |
| 61 | +``` |
| 62 | + |
| 63 | +## 📦 Releases |
| 64 | + |
| 65 | +To download the latest releases and updates, please check the [Releases section](https://github.com/FineG21/docker-lampp-stack/releases) for executable files. |
| 66 | + |
| 67 | +## 🗂️ Directory Structure |
| 68 | + |
| 69 | +Here is the structure of the project: |
| 70 | + |
| 71 | +``` |
| 72 | +docker-lampp-stack/ |
| 73 | +├── docker-compose.yml |
| 74 | +├── Dockerfile |
| 75 | +├── php/ |
| 76 | +│ ├── php.ini |
| 77 | +│ └── ... |
| 78 | +├── web/ |
| 79 | +│ ├── index.php |
| 80 | +│ └── ... |
| 81 | +└── database/ |
| 82 | + └── init.sql |
| 83 | +``` |
| 84 | +
|
| 85 | +### Configuration Files |
| 86 | +
|
| 87 | +- **docker-compose.yml**: Manages multi-container Docker applications. |
| 88 | +- **Dockerfile**: Contains instructions for building Docker images. |
| 89 | +- **php.ini**: Configuration file for PHP. |
| 90 | +- **init.sql**: Optional SQL file for database initialization. |
| 91 | +
|
| 92 | +## 🌐 Accessing the Environment |
| 93 | +
|
| 94 | +Once the Docker containers are running, access the services via the specified ports: |
| 95 | +
|
| 96 | +- **Web Application**: `http://localhost` |
| 97 | +- **phpMyAdmin**: `http://localhost:8080` |
| 98 | +- **Adminer**: `http://localhost:8081` |
| 99 | +
|
| 100 | +## 🔍 Additional Tools |
| 101 | +
|
| 102 | +### Redis |
| 103 | +
|
| 104 | +Redis is included in this stack for caching and session management. To use Redis, connect to it using your preferred Redis client. |
| 105 | +
|
| 106 | +### Composer |
| 107 | +
|
| 108 | +Composer is installed for dependency management in PHP projects. You can run Composer commands inside the PHP container. |
| 109 | +
|
| 110 | +### Node.js |
| 111 | +
|
| 112 | +Node.js is included for projects that require JavaScript on the server side. Install any necessary packages with `npm` or `yarn`. |
| 113 | +
|
| 114 | +## 🔑 Authentication |
| 115 | +
|
| 116 | +For phpMyAdmin and Adminer, you may want to set up your username and password. This can be done by modifying the environment variables in your `docker-compose.yml` file: |
| 117 | +
|
| 118 | +```yaml |
| 119 | +environment: |
| 120 | + MYSQL_ROOT_PASSWORD: yourpassword |
| 121 | +``` |
| 122 | + |
| 123 | +## 📝 Contributing |
| 124 | + |
| 125 | +We welcome contributions! If you would like to contribute to the project, please follow these steps: |
| 126 | + |
| 127 | +1. Fork the repository. |
| 128 | +2. Create your feature branch. |
| 129 | +3. Commit your changes. |
| 130 | +4. Push to the branch. |
| 131 | +5. Open a pull request. |
| 132 | + |
| 133 | +## 📄 License |
| 134 | + |
| 135 | +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. |
| 136 | + |
| 137 | +## 📢 Get Involved |
| 138 | + |
| 139 | +Join our community for discussions, support, and more: |
| 140 | + |
| 141 | +- **GitHub Issues**: Report bugs or request features. |
| 142 | +- **Discussions**: Share your thoughts, ideas, and suggestions. |
| 143 | + |
| 144 | +## 💬 Community Links |
| 145 | + |
| 146 | +- [Docker Community](https://www.docker.com/community/) |
| 147 | +- [PHP Community](https://www.php.net/community) |
| 148 | + |
| 149 | +## 💡 Tips for Usage |
| 150 | + |
| 151 | +- Keep your Docker images up to date. |
| 152 | +- Use `.env` files for environment variables to secure sensitive information. |
| 153 | +- Consider using Docker Volumes for persistent data storage. |
| 154 | + |
| 155 | +## 🎨 Customization |
| 156 | + |
| 157 | +Feel free to customize the Dockerfiles and configurations to better suit your projects. You can also add additional services as needed. |
| 158 | + |
| 159 | +## 🧩 Integrations |
| 160 | + |
| 161 | +The LAMPP stack can integrate with various CI/CD pipelines. Consider using GitHub Actions, Jenkins, or CircleCI for automated deployments. |
| 162 | + |
| 163 | +## 🕵️ Troubleshooting |
| 164 | + |
| 165 | +If you encounter issues: |
| 166 | + |
| 167 | +- Check the logs with `docker-compose logs`. |
| 168 | +- Ensure all services are running properly. |
| 169 | +- Consult the official documentation for Docker, PHP, and MariaDB. |
| 170 | + |
| 171 | +## 🔧 FAQs |
| 172 | + |
| 173 | +**Q: How do I switch PHP versions?** |
| 174 | + |
| 175 | +You can switch PHP versions by modifying the `Dockerfile` or the `docker-compose.yml` file to specify the desired PHP version. |
| 176 | + |
| 177 | +**Q: How do I persist my database?** |
| 178 | + |
| 179 | +Use Docker Volumes in your `docker-compose.yml` to ensure your database persists across container restarts. |
| 180 | + |
| 181 | +## 📈 Performance Tips |
| 182 | + |
| 183 | +- Optimize your Apache and PHP settings for better performance. |
| 184 | +- Use caching mechanisms like Redis to reduce database load. |
| 185 | +- Regularly update your dependencies. |
| 186 | + |
| 187 | +## 🌍 Community and Support |
| 188 | + |
| 189 | +For support, consider checking GitHub issues or joining Docker and PHP forums for community-driven assistance. |
| 190 | + |
| 191 | +## 🔗 Links |
| 192 | + |
| 193 | +- [Docker Official Documentation](https://docs.docker.com/) |
| 194 | +- [PHP Official Documentation](https://www.php.net/docs.php) |
| 195 | +- [MariaDB Documentation](https://mariadb.com/kb/en/documentation/) |
138 | 196 |
|
| 197 | +--- |
139 | 198 |
|
| 199 | +Thank you for checking out the **Docker LAMPP Stack**! We hope it serves you well in your web development journey. Happy coding! 🎉 |
| 200 | +``` |
0 commit comments