README.md

Docker-Laravel-Redis-Postgres-Nginx

Simple docker env, for local development.

About build:

  • composer (Dockerfile, project-init and start-entrypoint scripts)

    load clean laravel project template if not exists in ./app, or update vendor

  • app (Dockerfile and start-entrypoint)

    run after pre-build stage, create laravel-fpm container and serve by php-fpm (load www.conf, and php.ini from ./php)

  • cache (redis-alpine)
  • web (nginx-alpine)

    edit default.config.template in ./nginx/templates/

  • adm (adminer)

    works with mysql, postgres etc (change driver before login)

  • db (postgres:alpine)
  • example ‘.env’ config for build

    .env holds all build env every service (overrites laravel .env file)


Pre-build stage

Before run you should install docker on your PC.

How install docker, official docs

Checkout docker already installed, just run in terminal and you get docker version info

docker -v

Run composer service before and load laravel project source (build composer image and load empty laravel project)

docker compose up -d composer

Then remove composer service final pre-build stage

docker compose down --remove-orphans

Workflow

Run docker compose up

docker compose up -d

And now checkout in browser:

Adminer if want edit database manually

Nginx proxy for services (laravel-app)

Laravel official framework info

Laravel access on default port nginx, but serve by php-fpm server, settings edit in www.conf in ./php


Permission problem

You can add root access for your user (host machine)

alpine www-data user assign to 82 id, so create new user with same name group with same id on your host machine (example for ubuntu)

sudo groupadd -g 82 www
sudo useradd -u 82 -g 82 www

Now add your current user (host machine) into www group for full permission

sudo usermod -a -G www [user-name]

Add full permission for your user, use command as root (sudo) -R flag (recursive run)

sudo chown -R [user-name]:www /path/to/your/local/folder

How return default permission

This will return all back, use command as root (sudo) -R flag (recursive run)

sudo chown -R www /path/to/your/local/folder

Help tools

Описание

Docker environment: composer (load init laravel or update), laravel-fpm, redis, postgres, nginx, adminer.

Конвейеры
0 успешных
0 с ошибкой