Using Docker and Docker Compose as Development Environment

If you'd prefer to use a containerized environment to install and develop your Librarian application, you can use the librarianphp/librarian-docker repository as a base for your setup.

For that, you'll only need Docker and Docker Compose installed on your working machine.

Downloading the Files

You can download the files in this repository and save them in the root folder of your Librarian application.

The following files are required:

  • docker-compose.yml - Main configuration for your containerized environment
  • Dockerfile - This Dockerfile builds a custom app image based on PHP 8.2, with Composer and NPM installed
  • docker-compose/nginx/default.conf - Nginx configuration file for the containerized web server

Once the files are in place, you can get the environment up and running with:

docker-compose up -d

This will run the containers in background.

To execute commands such as composer install, run:

docker-compose exec app composer install

Running NPM:

docker-compose exec app npm install

Compiling css assets:

docker-compose exec app npm run dev

Stopping the environment:

docker-compose stop

Re-starting the environment:

docker-compose start

Destroying the environment:

docker-compose down

Built with Librarian by @erikaheidi.

Back to top