Skip to content

tzgued/symfony-angular-docker-compose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

symfony-angular-docker-compose

Docker compose for symfony + mysql + angular project

Setup

  1. Clone this repository
$ git clone https://github.com/zhooravell/symfony-angular-docker-compose.git
  1. Create .env file
$ cd symfony-angular-docker-compose && cp env.dist .env
  1. Set value to environment variables in .env
SYMFONY_APP=/absolute/path/to/symfony/app
ANGULAR_APP=/absolute/path/to/angular/app
  1. Fixing file permissions in Symfony App (Official documentation)
// For Linux
$ HTTPDUSER=$(ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\  -f1)
$ sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX var
$ sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX var
  1. Prepare docker
$ docker-compose pull
$ docker-compose build --force-rm
$ docker volume create --name=mysql-data
  1. Check docker config
$ docker-compose config
  1. Add symfony-app.dev to /etc/hosts
127.0.0.1   symfony-app.dev

Usage

Run development environment

$ docker-compose up

or run in background

$ docker-compose up -d

To down environment

$ docker-compose down

Useful

Show all container

$ docker-compose ps

Connect to container

$ docker exec -it {container_name} bash

Fix minor problem with docker images

$ docker-compose up --force-recreate

Hacks

For correct work with angular app you must fix package.json

"scripts": {
    "ng": "ng",
    "start": "ng serve --host 0.0.0.0",
    ....

Access to projects

Symfony: http://symfony-app.dev

Angular: http://localhost:4200

Phpmyadmin: http://localhost:3000

About

Docker compose for symfony + angular project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published