All Projects → Federkun → Docker Skeleton Php

Federkun / Docker Skeleton Php

Licence: mit
A simple Docker PHP development environment

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Docker Skeleton Php

Php Docker Boilerplate
🍲 PHP Docker Boilerplate for Symfony, Wordpress, Joomla or any other PHP Project (NGINX, Apache HTTPd, PHP-FPM, MySQL, Solr, Elasticsearch, Redis, FTP)
Stars: ✭ 503 (+1157.5%)
Mutual labels:  mysql, symfony, boilerplate, nginx
Docker Nginx Php Mysql
Docker running Nginx, PHP-FPM, MySQL & PHPMyAdmin
Stars: ✭ 1,322 (+3205%)
Mutual labels:  mysql, composer, nginx
Docker Laravel
Laravel 5 with Dockerized Gulp, PHP-FPM, MySQL and nginx using docker-compose
Stars: ✭ 85 (+112.5%)
Mutual labels:  mysql, composer, nginx
Typo3 Docker Boilerplate
🍲 TYPO3 Docker Boilerplate project (NGINX, Apache HTTPd, PHP-FPM, MySQL, Solr, Elasticsearch, Redis, FTP)
Stars: ✭ 240 (+500%)
Mutual labels:  mysql, boilerplate, nginx
Stacker
Stacker - The environment for local web development, ready for use.
Stars: ✭ 356 (+790%)
Mutual labels:  mysql, symfony, nginx
Docker Symfony
🐳 A docker multicontainer with NGINX, PHP7-FPM, MySQL and ELK (Elasticsearch Logstash and Kibana)
Stars: ✭ 1,305 (+3162.5%)
Mutual labels:  mysql, symfony, nginx
Docker Laravel
🐳 Build a simple laravel development environment with docker-compose.
Stars: ✭ 415 (+937.5%)
Mutual labels:  mysql, composer, nginx
Vagrant Php Dev Box
PHP 7 vagrant development box with nginx, php-fpm, MySQL, Symfony, Laravel, ... on Ubuntu 16.04
Stars: ✭ 473 (+1082.5%)
Mutual labels:  mysql, symfony, nginx
Thelia
Thelia is an open source tool for creating e-business websites and managing online content. Repo containing the new major version (v2)
Stars: ✭ 752 (+1780%)
Mutual labels:  mysql, symfony
Docker Testing
Stars: ✭ 18 (-55%)
Mutual labels:  mysql, nginx
Jale
Jale is a blazing fast local development environment for MacOS written in Typescript.
Stars: ✭ 24 (-40%)
Mutual labels:  mysql, nginx
Reactprimer
React component prototyping tool that generates fully connected class component code.
Stars: ✭ 743 (+1757.5%)
Mutual labels:  boilerplate, skeleton
Akka Http Microservice
Example of http (micro)service in Scala & akka-http
Stars: ✭ 701 (+1652.5%)
Mutual labels:  boilerplate, skeleton
React Express Fullstack
Full stack (mostly unopinionated) starter pack with React+Redux and Expressjs
Stars: ✭ 23 (-42.5%)
Mutual labels:  mysql, nginx
Laravel Ubuntu Init
A shell script for setting up Laravel Production environment on Ubuntu 14.04 & Ubuntu 16 & Ubuntu 18 system.
Stars: ✭ 695 (+1637.5%)
Mutual labels:  mysql, nginx
Php Interview
PHP后端开发面试指南。
Stars: ✭ 26 (-35%)
Mutual labels:  mysql, nginx
Springbootunity
rabbitmq、redis、scheduled、socket、mongodb、Swagger2、spring data jpa、Thymeleaf、freemarker etc. (muti module spring boot project) (with spring boot framework,different bussiness scence with different technology。)
Stars: ✭ 845 (+2012.5%)
Mutual labels:  mysql, nginx
Leafpub
Simple, beautiful, open source publishing.
Stars: ✭ 645 (+1512.5%)
Mutual labels:  mysql, composer
Wp Multitenancy Boilerplate
WordPress multitenancy boilerplate configured and managed with Composer and PHP dotenv.
Stars: ✭ 24 (-40%)
Mutual labels:  composer, boilerplate
Accompli
An easy to use and extendable deployment tool for (PHP) projects.
Stars: ✭ 9 (-77.5%)
Mutual labels:  symfony, composer

docker-skeleton-php

nginx mysql php5.6 php7.0 php7.1

Usage

  1. Copy .env.dist to .env:

    $ cp .env.dist .env
    
  2. If you plan to use the default docker repository to pull the Docker’s images, you can keep the default values of the PROJECT_NAMESPACE and REPOSITORY_NAME environment variables from the .env file and skip this step. Otherwise you need to build your own images. You can do that with:

    $ ./bin/build
    
  3. Start the container.

    $ docker-compose up -d
    
  4. Access your application via http://localhost/.

Documentation

Docker

Useful docker commands

# Start containers.
$ docker-compose up -d

# Restart services.
$ docker-compose restart

# List containers.
$ docker-compose ps

# Start a terminal session for <container_name> (i.e: php).
$ docker-compose exec <container_name> /bin/bash

# View logs.
$ docker-compose logs

# List/remove network.
$ docker network [ ls | rm <network_name> ]

# List/remove volumes.
$ docker volume [ ls | rm <volume_name> ]

# Stop containers.
$ docker-compose stop

# Stop and remove containers. Any data which is not in a volume will be lost.
$ docker-compose down

PHP

Choose a different version of php

By default docker-compose.yml uses the latest tag name of the php image which corresponds to php 7.1.

services:
  php:
    image: ${PROJECT_NAMESPACE}/${REPOSITORY_NAME}-php:latest

If you want a specific version of php, you can change it with one of those values: 5.6, 7.0 or 7.1. Example:

  php:
    image: ${PROJECT_NAMESPACE}/${REPOSITORY_NAME}-php:5.6

The default docker repository already provides the images for those php version. Otherwise you need to build them by yourself with:

$ ./bin/build

Add PHPMyAdmin

Edit docker-compose.yml and add a new service definition:

services:
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    ports:
     - "8080:80"
    environment:
      PMA_HOST: mysql
    networks:
      - backend

Then phpmyadmin will be accessible to http://localhost:8080/

Composer basic usage

Place the composer.json file that describes the dependencies of your project inside the app folder, then install the defined dependencies through the php container:

$ docker-compose run --rm php composer install

Create a new Symfony project

You can use Composer to ease the creation of a new symfony project:

$ rm -rf app/* && docker-compose run --rm -u $(id -u):$(id -g) php composer create-project symfony/framework-standard-edition .

As from Symfony3.2 you can use the environment variables into you service container configuration, using the %env(MYSQL_DATABASE)% notation:

Symfony config

Composer will create a new Symfony Standard Edition application under the app/ directory.

A minimum configuration file to get your application running under Nginx is already provided from docker-skeleton-php. Remove the default.conf file and rename symfony.conf.example into symfony.conf:

$ rm sites/default.conf
$ mv sites/symfony.conf.example sites/symfony.conf

Now remove the access check from app/web/app_dev.php:

// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.
if (isset($_SERVER['HTTP_CLIENT_IP'])
    || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
    || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1']) || php_sapi_name() === 'cli-server')
) {
    header('HTTP/1.0 403 Forbidden');
    exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}

Warning: After you deploy to production, make sure that you cannot access the app_dev.php

You can start the containers now:

$ docker-compose up -d

Symfony console

How can I use Symfony's console?

  • For Symfony 3:

    $ docker-compose run --rm php php bin/console
    
  • For Symfony 2:

    $ docker-compose run --rm php php app/console
    
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].