Setting up a PHP decent development environment

After years of spaghetti code (I’m Italian, I do really know what spaghetti are) I’m trying to set up a decent php development environment.

This is my battleplan:

  • Errors building two different projects with stack on the same machine
  • Installing npm dependencies inside docker and testing from volume
  • how to redirect no-www to www under jwilder/nginx-proxy?
  • docker - cannot find aws credentials in container although they exist
  • Updating Short and Full Descriptions on Docker Hub
  • How can I mount a user's existing .ssh directory into a Docker container?
    1. install git and docker on my laptop;
    2. create a docker virtual enviroment as much similar as possible to
      the production LAMP (shared) server;
    3. use sshfs to mount the docker VE web server root directory on my laptop;
    4. on the laptop, init a git repository inside the mount point;
    5. use my favourite ide (aptana studio) to create a php project in the mount point directory;
    6. test the code pointing a browser to docker VE ip;
    7. set up a bitbucket account to automatically deploy git commits on production server.

    What do you think about? Any chance it could work?

    Thanks!

  • A way to test if processes running inside docker are on the same host
  • Run Docker PHP-apache: Forbidden You don't have permission to access / on this server
  • What is the proper endpoint for connecting to azure container service swarm cluster from c# https://github.com/Microsoft/Docker.DotNet
  • Docker - Local Development on container
  • Install docker 1.11 on Fedora 21
  • How to configure a Docker container for acquiring DHCP IP/s from dhcp server running on ESX
  • One Solution collect form web for “Setting up a PHP decent development environment”

    I suggest using the official php language docker image:

    https://registry.hub.docker.com/_/php/

    This enables you to create an image that packages your php code, rather than having to map volumes at run-time.

    Example 1 (with Dockerfile)

    ├── build_and_run.sh
    ├── Dockerfile
    └── src
        └── index.php
    

    Dockerfile

    FROM php:5.6-apache
    COPY src/ /var/www/html/
    

    build_and_run.sh

    Script that builds a new container image and launches it:

    docker build -t my-php-app .
    docker run -it --rm --name my-running-app -p 8080:80 my-php-app
    

    Apache is configured to listen on port 8080

    Example 2 (without Dockerfile)

    The php image can also be run without a docker file. Just provide a mapping to the source code locally:

    docker run -it --rm --name my-apache-php-app -v "$(pwd)/src":/var/www/html -p 8080:80 php:5.6-apache
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.