An open API service indexing awesome lists of open source software.

https://github.com/greg0/php-runtime-env

docker-compose environment for PHP app local development
https://github.com/greg0/php-runtime-env

Last synced: 4 months ago
JSON representation

docker-compose environment for PHP app local development

Awesome Lists containing this project

README

          

Image build
===========

```shell
make build image=php8.0
```

Docker-compose
==============

Put your PHP application into `src/` and public files (e.g. `index.php`) into `src/public/`

[Makefile](`Makefile`) provides shortcuts. Argument `php` is optional

```shell
make start php=8.0
```

For xdebug images

```shell
make debug php=8.0
```

To stop containers

```shell
make stop
```

Files organization
==================

Nginx listening for files in `src/public/` on port `8080`.

Composer
========

To run composer inside container exec

```
docker exec -it project_dir_php_1 composer install
```

or use official composer image https://store.docker.com/images/composer

> Note: Official composer image is used unside `php` container.

Permissions in linux volumes
===========================

For fresh docker installation read [Post-installation steps for Linux](https://docs.docker.com/install/linux/linux-postinstall/)

To avoid permissions issues follow instructions from article
"[Use Linux user namespaces to fix permissions in docker volumes](https://www.jujens.eu/posts/en/2017/Jul/02/docker-userns-remap/)"

#### TL;DR;

Word `USER` in listings should be replaced by your system user name: `id -u -n`

1. Create or add to existing file `/etc/docker/daemon.json`

```json
{
"userns-remap": "USER"
}
```

2. Edit file `/etc/subuid`

```
USER:1000:1
USER:100000:65536
```

3. Edit file `/etc/subgid`

```
USER:996:1
USER:100000:65536
```

Replace `996` with value returned by command `getent group docker`

---

Instead of above you can also often run

```shell
chown $(id -un) -R .
```