One of the internal php projects that I manage, was using Ubuntu base for php/apache (Dockerfile available on Github) This weekend I have decided to convert this stack to Alpine+Nginx+PHP
A quick google search shows that not many people are using this stack for their project. After a bit of research and testing, I published this stack and was able to successfully use for our project.
After converting the stack to Alpine based, I was able to bring down the size of the project container image upto 70%
The image as it is, is very small and has only 70MB uncompressed / 21MB compressed size
TL;DR
https://github.com/getvivekv/alpine-docker-nginx-php7
Contents
This docker image was built with the following components
- Alpine 3.12
- PHP 7.3
- Nginx 1.18
- Runit as process supervisor
How to use
FROM getvivekv/alpine-docker-nginx-php7
# Copy your project content
COPY html /var/www/html
RUN composer install --optimize-autoloader --no-interaction --no-progress