GithubHelp home page GithubHelp logo

docker-php's Introduction

Docker for PHP development on your local machine

Docker for PHP development on mac OSX with Docker for MAC.

This was tested with: Drupal 6 and 7 and Symfony but should works with any PHP applications.

By default docker-compose will launch 4 containers:

  • nginx
  • phpfpm (7.0 or 5.7)
  • db (mariadb)
  • mailhog (MailHog is configured to catch all email send by the phpfpm server)

Nginx and phpfpm are on debian 8. Other containers are using smaller alpine image.

You can change the configuration of nginx or phpfpm in Dockerfiles folder to meet you need.

This project use http://docker-sync.io/ to sync your code with docker. This is a workaround to get (very) good performance until Docker for MAC shared volume is fixed.

To install docker-sync:

$ gem install docker-sync

Start a new project

Copy every file of this repository in the root of your project.

By default nginx is configured to serve ./app/web. So, add your code in ./app/web, then:

In a terminal start the synchronisation and let it run:

$ docker-sync start

In another terminal launch your containers:

$ docker-compose up

All logs are redirected to the console, so you can quickly check nginx, php or mysql message.

Then load http://localhost:8080 on your browser, you should see your PHP app.

PHP version

Configurations for PHP7.0 and PHP5.6 are provided and work out of the box. You can chose the version you want by editing the docker-compose.yml file:

For PHP 5.7:

phpfpm:
    build:
        context: ./Dockerfiles/phpfpm/5.7

For PHP 7.0:

phpfpm:
    build:
        context: ./Dockerfiles/phpfpm/7.0

Access DB on localhost

The DB port is exposed. To easily access it you can add this to your /etc/hosts

db 127.0.0.1

Emails

All emails are caught (no email can go out accidentally) and stored in RAM. You can read emails on the MailHog web interface: http://localhost:8025 .

Screenshot of MailHog web interface

docker-php's People

Contributors

gagarine avatar zufrieden avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.