README.md

Docker-Symfony-Redis-Postgres-Nginx

Simple docker env, for local development.

About build:

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

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

  • app (Dockerfile and start-entrypoint)

    run after pre-build stage, create symfony-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 symfony .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 symfony project source (build composer image and load empty symfony 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 (symfony-app)

Symfony official framework info

Symfony 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 symfony or update), symfony-fpm, redis, postgres, nginx, adminer.

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