Sign inSign up

ciandt/php

By ciandt

Updated about 4 years ago

These Docker image(s) intends to be a containerized PHP/Apache solution for multiple purposes.

Image
3

10K+

ciandt/php repository overview

CI&T PHP Docker image(s)

These Docker image(s) intends to be a containerized PHP/Apache solution for multiple purposes.

The source code is available under GPLv3 at Github in this [link]((https://github.com/ciandt-dev/docker-hub-php).

By utilizing Docker technologies, that already provides an easy way of spinning up new environments along with its dependecies. This image can speed up developers which different backgrounds and equipments to create quickly a new local environment allowing them to easily integrate in automated tests and deployment pipelines.

At this moment we have the following version(s).

Acquia

Our intent is to be a Docker container that mimics PHP/Apache running on Acquia environment with the same version of softwares, packages, modules and its underlying operating system.

Acquia publishes a table with its platform infrastructure information on the link: https://docs.acquia.com/cloud/arch/tech-platform

These images will have the following name pattern: acquia-YYYY-MM-DD

Bundled software versions

These are the currently software versions bundled in the image(s) by tag.

  • acquia-latest OR acquia-2016-11-30
    • Ubuntu 12.04.5
    • Apache 2.2.22
    • PHP 5.6.28 (plus extensions)
      • APCu 4.0.10
      • Gnupg 1.4.0
      • HTTP 2.5.6
      • Igbinary 1.2.1
      • Imagick 3.4.3RC1
      • Memcache 3.0.8
      • Mongo 1.6.14
      • Oauth 1.2.3
      • Propro 1.0.2
      • Raphf 1.1.2
      • SSH2 0.12
      • Upload Progress 1.0.3.1
      • Xdebug 2.4.1
      • Xhprof 0.9.4
      • YAML 1.3.0
    • Dumb-init 1.2.0
    • Pre-loaded scripts for customization
      • Composer 1.2.1
      • Drush 8.1.3
      • Grunt CLI 1.2.0
        • Compass 1.1.1
      • Node.js 0.10.37
      • Ruby 2.3.0
        • Bundler 1.13.6
        • Compass 1.0.3

Deprecated

  • acquia-2016-11-25
  • acquia-2016-11-14

Quick Start

Download the image

docker pull ciandt/php:acquia-latest

Run a container

docker run \
  --name myContainer \
  --detach \
  ciandt/php:acquia-latest

Check running containers

docker ps --all

Running standalone

If you just need the container there is a snippet that can help running in standalone mode.

# define variables
HOST_CODE_FOLDER=""${HOME}"/workspace/mySite"
HOST_FILES_FOLDER=""${HOME}"/workspace/myNFSstorage"
DOCKER_CONTAINER_NAME="myContainer"
DOCKER_IMAGE="ciandt/php:acquia-latest"

# run your container
docker run \
  --volume "${HOST_CODE_FOLDER}":/var/www/html \
  --volume "${HOST_FILES_FOLDER}":/nfs \
  --name "${DOCKER_CONTAINER_NAME}" \
  --detach \
  "${DOCKER_IMAGE}"

After run, you can inquiry Docker service and get the IP address of your newly running container named myContainer by using the following command:

docker inspect --format '{{ .NetworkSettings.IPAddress }} myContainer'

Let's suppose that the returned IP address was 172.17.0.2. Just open a browser and try to access:

Your website should be displayed perfectly.


Customizing

As intended, you can take advantage from this image to build your own and already configure everything that a project requires.

CI&T scripts

There are available scripts to help customization:

  • install-composer
  • install-drush
  • install-grunt
  • install-nodejs
  • install-ruby

Scripts are composed by two parts;

  • one executable file script-name.sh
  • one variables file script-name.env

The script-name .env contains the variables that script-name .sh requires to perform its task.

All scripts are located inside folder /root/ciandt and must be declared in the Makefile. Thus, it is easy to run any of them and have its dependency. Please check the section in app/scripts/Makefile of the correspondent script to see if there is any other dependency that needs to declare additional environment variables.

Just to give an quick example, you can create your own Docker image based on this one that already ships Drush installed as well. A Dockerfile performing it could be like:

FROM ciandt/php:acquia-latest

# installs required package
RUN apt-get update \
    && apt-get install \
                --no-install-recommends \
                --assume-yes \
                make

# defines Composer and Drush versions
ENV COMPOSER_VERSION 1.2.1
ENV DRUSH_VERSION 8.1.3

# installs Drush
RUN cd /root/ciandt \
    && make install-drush

Then you just need to build / run your new customized Docker image and you are ready to go.


Running in Docker-Compose

Since a project is not going to use solely this container, it may need a Docker-Compose file.

Just to exercise, follow an example of this running customized and also behind a Nginx proxy.

Create a new folder and fill with these 3 files and respective folders;

conf/php.local.env
## Nginx proxy configuration
# https://hub.docker.com/r/jwilder/nginx-proxy/
VIRTUAL_HOST=mySite.local
app/php/Dockerfile
FROM ciandt/php:acquia-latest

# installs required package
RUN apt-get update \
    && apt-get install \
                --no-install-recommends \
                --assume-yes \
                make

# defines Composer and Drush versions
ENV COMPOSER_VERSION 1.2.1
ENV DRUSH_VERSION 8.1.3

# installs Drush
RUN cd /root/ciandt \
    && make install-drush
docker-compose.yml
php:
  build: ./php
  container_name: php
  env_file: ../conf/php.local.env

nginx:
  image: jwilder/nginx-proxy:latest
  container_name: nginx
  volumes:
    - /var/run/docker.sock:/tmp/docker.sock:ro
  ports:
    - "80:80"
    - "443:443"

Then just spin-up your Docker-Compose with the command:

docker-compose up -d

Inspect Nginx container IP address:

docker inspect \
        --format \
        "{{.NetworkSettings.Networks.bridge.IPAddress }}" \
        "nginx"

Use the IP address to update hosts file. Let's suppose that was 172.17.0.2.

Then, add an entry to /etc/hosts.

172.17.0.2 php.local

And now, try to access in the browser

Voilà! Your project now have Nginx and PHP/Apache up and running. \o/


User Feedback

Issues

If you have problems, bugs, issues with or questions about this, please reach us in Github issues page.

Needless to say, please do a little research before posting.

Contributing

We gladly invite you to contribute fixes, new features, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can.

Before you start to code, we recommend discussing your plans through a GitHub issue, especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing.

Documentation

There are two parts of the documentation.

First, in the master branch, is this README.MD. It explains how this little scripts framework work and it is published on Github page.

Second, in each image version there is an additional README.MD file that explains how to use that specific Docker image version itself. Latest version is always the one seen on Docker Hub page.

We strongly encourage reading both!


Please feel free to drop a message in the comments section.

Happy coding, enjoy!!

"We develop people before we develop software" - Cesar Gon, CEO

Tag summary

Content type

Image

Digest

Size

319.7 MB

Last updated

over 5 years ago

docker pull ciandt/php