A Docker image with PHP, Composer, Laravel, and the latest Node.js.
416
Source Code on Github
This repository provides a Docker image based on php:8.2-fpm with commonly used development tools pre-installed. It includes:
By mounting your local working directory into the container, you can immediately utilize laravel, php, git, npm, and other tools without installing them on your host machine.
Below are common usage examples. In all commands, -v "$PWD:/app" mounts your current directory to the container’s /app directory. This means any commands you run inside the container will affect files in your local directory.
docker run --rm -it -v "$PWD:/app" softjpn/laravel-nodejs-dev laravel new example-app
Explanation:
docker run --rm -it: Runs a temporary container interactively and removes it upon exit.-v "$PWD:/app": Mounts your current directory on the host to the /app directory in the container.softjpn/laravel-nodejs-dev: The name of the Docker image.laravel new example-app: Uses the Laravel Installer to create a new Laravel project named example-app.Suppose you have a file named helloworld.php in your current directory. You can run it like this:
docker run --rm -it -v "$PWD:/app" softjpn/laravel-nodejs-dev php helloworld.php
Explanation:
php helloworld.php: Tells the container to run your local helloworld.php using PHP.laravel-nodejs-dev docker run --rm -it -v "$PWD:/app" softjpn/laravel-nodejs-dev node ./helloworld.js
docker run --rm -it -v "$PWD:/app" softjpn/laravel-nodejs-dev php --version
Explanation:
php --version: Outputs the PHP version installed in the container.docker run --rm -it -v "$PWD:/app" softjpn/laravel-nodejs-dev git --version
Explanation:
git --version: Outputs the Git version installed in the container.docker run --rm -it -v "$PWD:/app" softjpn/laravel-nodejs-dev npm --version
Explanation:
npm --version: Outputs the npm version installed in the container.npm install, npm run dev, etc.).php-fpm. Typically this is used in a larger Docker Compose setup for Laravel applications./app as its working directory, so remember to mount your project into /app.docker-php-entrypoint, ensuring that PHP-FPM or any PHP commands will run correctly.This image is designed to be a versatile and lightweight development environment. It streamlines your workflow by bundling several frequently used tools into a single container, allowing you to keep your local development environment clean while still having powerful, up-to-date tools at your disposal.
Content type
Image
Digest
sha256:0c59e9919…
Size
267.1 MB
Last updated
almost 2 years ago
docker pull softjpn/laravel-nodejs-dev