Adding PHP Extensions using Docker Compose
this is my code. its already running on my server.
web:
image: nginx:latest
ports:
- "80:80"
volumes:
- ./code:/code
- ./site.conf:/etc/nginx/conf.d/site.conf
links:
- php
php:
#remove this
#dockerfile: extensions
#image: php:7-fpm
#change with build ...
build: './docker/php'
volumes:
- ./code:/code
Then, add Dockerfile
file to the docker/php
folder:
FROM php:7-fpm
RUN apt-get update && apt-get install -y \
libicu-dev \
&& docker-php-ext-install \
intl \
&& docker-php-ext-enable \
intl
Now you can run Dockerfile inside docker-compose.
In your extensions
file, add this to the top:
FROM php:7-fpm
and remove the image: php:7-fpm
from your docker-compose file