Overview
Inception is a 42 infrastructure project that packages a WordPress site as three services managed by Docker Compose. I wrote a Dockerfile for each service using Alpine Linux as the base, along with shell scripts that initialize each service when its container starts.
Visit the repository for source and setup instructions.
What I Built
- NGINX is the only service that publishes a port on the host. It serves static files over HTTPS on port 443 and forwards PHP requests to PHP-FPM over FastCGI. Its startup script generates a self-signed TLS certificate for the local deployment.
- WordPress runs through PHP-FPM. Its startup script waits for MariaDB to respond, then uses WP-CLI to install and configure WordPress and create the required accounts if they are missing.
- MariaDB stores the site's content and settings. On first startup, its script initializes the data directory and creates a dedicated database and user for WordPress.
Details
Service boundaries and persistent data
The services communicate over a dedicated Docker bridge network. WordPress files and MariaDB data are stored in separate host-backed volumes so they survive container recreation. PHP-FPM can write to the WordPress volume, and NGINX mounts the same volume read-only to serve static files.
First startup and subsequent restarts
MariaDB bootstraps its database on a fresh volume. The WordPress startup script waits for MariaDB with a bounded retry loop, then checks for existing files, configuration, and accounts before creating them. Compose mounts passwords as file-backed secrets and reads settings such as the site domain and data path from an environment file.
Notes
Run make to build and start the stack after configuring the domain and local secret files. Use make status to check container state, make logs to follow output, and make down to stop the services while preserving data. The setup uses a self-signed certificate, so browsers display a certificate warning. The repository includes a user guide for setup and a developer guide that explains the request path and startup behavior.