Create a WAMP environment with docker
Here is a simple way to make a WAMP server with Docker.
WAMP is an architecture based on Windows,Apache,MySQL,PHP.
But actually, with Docker, we are not constrained by using Windows, so the real architecture is XAMP. (X means all OS)
To do it, first, install Docker on your computer / server.
Create these files in your project folder:
./Dockerfile
./docker-compose.yaml
./www/public/index.php
Put your PHP code in ./www/
directory. The public directory would be ./www/public/
in this case.
The Dockerfile
FROM php:apache AS php_dev
RUN pecl install xdebug && docker-php-ext-enable xdebugRUN a2enmod rewriteRUN a2enmod headers
# Install Postgre PDO# RUN apt-get update \\# && apt-get install -y libpq-dev \\# && docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \\ # Install postgres extensions# && docker-php-ext-install pdo pdo_pgsql pgsql
COPY --from=composer /usr/bin/composer /usr/bin/composer # Install composer in the container
# Point to /var/www/html/public/ folderENV APACHE_DOCUMENT_ROOT /var/www/html/public/RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.confRUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
FROM php AS php_prod# Your prod config here
Note: the highlighted lines are about installing composer and postgresql database extension. Comment them if you don’t need them !
The docker-compose.yml
version: "3.4"
services: site: build: context: . target: php_dev ports: - "80:80" volumes: - ./www/:/var/www/html/
adminer: image: adminer ports: - "8080:8080"
database: image: mysql ports: - "3306:3306" environment: - MYSQL_ROOT_PASSWORD=root - MYSQL_DATABASE=test - MYSQL_USER=admin - MYSQL_PASSWORD=root
The PHP code
<?phpvar_dump('TEST XDEBUG');
phpinfo();
And then do docker-compose up
and target the port 80 of your machine (generally http://localhost:80)
Don’t forget to add tags to freeze the dependencies and images you installed !
The SOLID/STUPID principles
Learn what are the SOLID and STUPID principles with examples
Create a Docker Swarm playground
Let's create Docker Swarm playground on your local machine
Setup a Kubernetes cluster with K3S, Traefik, CertManager and Kubernetes Dashboard
Let's setup step by step our own K3S cluster !
Create an Ansible playground with Docker
Let's create an Ansible playground with Docker
Database ACID/BASE - Understanding the CAP Theorem
Learn what is the CAP Theorem in less than 5 minutes !
HashiCorp Vault - Technological watch
Learn what is HashiCorp Vault in less than 5 minutes !
How to internationalize an AstroJS website while maintaining good SEO ?
We will see how to create an implementation of i18n with AstroJS
Remember all the commands of a project with Makefile
We will see how to remember all command of a project & write documentation with Makefile !