This is the step-by-step TODO list to complete the Docker infrastructure project. Follow in order — check items off as you progress.
- Install Docker and Docker Compose on your VM
- Install Make (build automation)
- Set up project folder structure as required in subject
- Configure
/etc/hosts→ add127.0.0.1 <your_login>.42.fr - Create
.gitignoreto exclude secrets,.env, volumes, etc.
- In
docker-compose.yml, define a custom bridge network
- Write
Dockerfile(base: Alpine or Debian) - Install and configure MariaDB server
- Use environment variables for DB credentials (stored in
.env) - Configure DB persistence with volume →
/var/lib/mysql - Mount DB password/credentials from
secrets/ - Ensure container runs with
restart: always
- Write
Dockerfile(base: Alpine or Debian) - Install php-fpm and WordPress
- Configure php-fpm to run in foreground (PID 1 best practice)
- Connect to MariaDB using environment variables
- Mount WordPress files volume →
/var/www/html - Ensure container runs with
restart: always
-
Write
Dockerfile(base: Alpine or Debian) -
Install NGINX
-
Generate TLS certificates (OpenSSL or mkcert)
-
Configure NGINX:
- Reverse proxy to WordPress php-fpm service
- Enforce TLSv1.2 and TLSv1.3 only
- Redirect traffic to HTTPS (443 only)
-
Mount TLS certificates securely
-
Ensure container runs with
restart: always
- Create
.envfile → store environment variables (DB user, DB name, domain, etc.) - Store sensitive data in
secrets/(e.g., passwords, root password) - Reference
.envand secrets indocker-compose.yml
-
Write a
Makefilewith targets:-
make build→ build all images -
make up→ run docker-compose -
make down→ stop containers -
make clean→ remove containers, images, volumes -
make restart→ rebuild and restart project
-
- Start containers:
make up - Check MariaDB persistence → stop & restart, DB should survive
- Open
https://<your_login>.42.frin browser → verify NGINX TLS - Verify WordPress setup connects to MariaDB
- Create required users in WordPress DB (admin + regular user)
- Kill a container → ensure it auto-restarts
- Restart VM → check project comes back with
make up
- Add Redis container → connect via WP plugin
- Add FTP server container → link to WordPress volume
- Add Adminer container → manage MariaDB via web UI
- Add static website (HTML/JS or other language except PHP)
- Add a custom useful service of your choice
- Verify
.gitignore→ no secrets committed - Check
Makefile→ all commands functional - Check
.envvariables are used properly - Validate WordPress admin username rule (no
admin/administratorvariants) - Prepare explanation for each service, configuration, and security choice
🔹 1. Make initdb.sh idempotent
Right now, the script always runs user creation on every container start. If you restart the container, MariaDB will complain (users already exist).
You can wrap SQL creation in IF NOT EXISTS (you already did for users & DB ✅).
That’s fine, but consider also skipping the ALTER USER root... if already set. For now, you can leave it — it won’t break, just slower startup.
2.write later to configure wp-config.php in wp docker file