Problem
The current Dockerfile has several inefficiencies that impact build time, image size, and security:
- Image Size: PHP image is 2.12GB (disk usage) / 423MB (content size) — can be reduced by ~40–50%.
- Security Issues: Running as root user, unnecessary packages installed, using
COMPOSER_ALLOW_SUPERUSER=1.
- Build Inefficiency: 15+ separate
RUN commands creating unnecessary layers.
- Missing Optimizations: No multi-stage build separation, inefficient caching.
Current State
IMAGE DISK USAGE CONTENT SIZE
bewelcome/php:latest 2.12GB 423MB
bewelcome/nginx:latest 219MB 76MB
We should also match the MariaDB version until we migrate the platform
mysql Ver 15.1 Distrib 10.1.48-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2