Skip to content

jonatascabral/docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Jonatas Cabral
Aug 21, 2019
7636ffe · Aug 21, 2019

History

36 Commits
Jan 18, 2018
Aug 21, 2019
Dec 29, 2017
Aug 16, 2018
Jan 18, 2018
Jan 18, 2018
Jan 18, 2018
Aug 21, 2019
Aug 21, 2019
Jan 18, 2018
Aug 16, 2018

Repository files navigation

Docker Simple Configuration for PHP development

Docker compose file to configure a simple php development server with nginx or apache, using the mysql database;

Requirements

  • Docker >= 1.13;
  • Docker compose >= 1.18;
  • For command line addproject binary:
    • PHP >= 5.6 with shell_exec and exec functions enabled;
    • pdo_mysql (For mysql database);
    • pdo_pgsql (For postgres database);

Includes

  • PHP 7.1 FPM with extensions:

    bcmath calendar Core ctype curl
    date dom fileinfo filter ftp
    gd gettext hash iconv intl
    json libxml mbstring mcrypt mysqlnd
    openssl pcre PDO pdo_mysql pdo_sqlite
    Phar posix readline Reflection session
    SimpleXML soap SPL sqlite3 standard
    tokenizer xml xmlreader xmlwriter zlib
    • Check the php docker file on configs/docker/images/php/Dockerfile to install another extensions
    • See php-docker for more information about installing extensions on a php docker container;
  • MySQL 5.7;

  • Postgres 9.6;

  • Nginx 1.13;

  • Apache 2.24;

Usage

...
# Select your prefered database on on docker-compose.yml service database
  database:
    extends:
      file: database.yml
      # service: mysql
      # service: pgsql
...

...
# Select your prefered webserver on on docker-compose.yml service webserver
  webserver:
    extends:
      file: webserver.yml
      # service: nginx
      # service: apache
...
# Start the containers
$ docker-compose up -d
  • Enjoy the docker magic 😆

Adding projects

The project comes with a php file to include projects (bin/addproject.php), the file reads a json and create the virtualhost, database and user for the project;

Usage

# Duplicate the file configs/projects.json.default to configs/projects.json
$ cp configs/projects.json.default configs/projects.json
// Configure the project
...
  "server_id": {
    "webserver": "apache|nginx",
    "database": "mysql|postgres",
    "database_rootpassword": "123456",

    "server_name": "",
    "document_root": "",
    "upload_root": "",
    "database_name": "",
    "database_user": "",
    "database_password": ""
  },
...
  • Check the comments on file for more information
# Run the php file
$ php bin/addproject.php <project name>

Example

...
  "foo-project": {
    "webserver": "nginx",
    "database": "postgres",
    "database_rootpassword": "postgres",

    "server_name": "foo.bar.com",
    "document_root": "/var/www/foobar",
    "upload_root": "/var/www/uploads/foobar",
    "database_name": "foo_bar",
    "database_user": "foo_bar_user",
    "database_password": "foo_bar_secret"
  },
...
$ php bin/addproject.php foo-project
  • Don't forget to append the server_name to your machine hosts file;

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published