This Dockerfile allows you to build an image for PHP8 and Node 16. This image can support development with databases such as MongoDB and MySQL, the php extensions for these DBs have been integrated. The image created will have the following packages for development
- PHP 8.x
- Node 18.x
- Composer
- PHP extensions for Mongo
- PHP extensions for MySQL
- 9000
- 5000 - 6000 (For Node)
Note: This assumes you have Docker installed in your machine.
In order to build the image follow the steps below
- Clone the repo
git clone https://github.com/stescacom/dev-php-node-img.git
- cd into the cloned repo
- Run
docker build . -t <<your image tag>>
To create a container from the built image run
docker run -v <<php project folder>>:/var/www << image tag >> --name << container name >>
In order to use the recently built image with docker-compose.yml
, consider the following example.
docker-service-name:
image: << your image tag >>
container_name: << container name >>
restart: unless-stopped
tty: true
user: root
environment:
SERVICE_NAME: << service name >>
SERVICE_TAGS: << service tag >>
working_dir: /var/www
volumes:
- ".:/var/www"