Skip to content

anapsix/docker-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

anapsix/php

42MB container image with basic PHP 5.6 installation and Composer, based on AlpineLinux.
If you need to run PHP scripts inside containers, but don't want the bulk of Ubuntu..

Build Status

Usage

Running anapsix/php

  1. make sure to have required dependencies in composer.json

  2. run your php scripts as:

     docker run -it --rm -v $(pwd):/app anapsix/php --upgrade ./script_name.php
    

Building FROM anapsix/php

Make your own image based on this one like so (see [./example][https://github.com/anapsix/docker-php/tree/master/example]):

FROM anapsix/php
CMD ["./myscript.php"]

To install additional dependencies for your script/application, you can place package names (one per line, comments and empty lines are ignored) into ./deps.apk. It will be checked for during the build and packages will be installed via apk.
To install build-time only dependencies (system libraries, etc), placepackage names into ./deps_build.apk. They will be removed after compose install.

For list of available packages see http://pkgs.alpinelinux.org/packages.

For additional convenience, if ./deps.sh exists and is executable, it will be run after ./deps.apk is processed. This should allow you to install additional libraries not available in AlpineLinux APK repository or perform any custom action (i.e. create users, clone a repo, install packages from pecl/pear, etc).
Similarly to ./deps_build.apk, ./deps_build.sh can be used for custom build-time pre-composer install steps. It is expected to be executable, if present. After compose install it will be executed again with --cleanup argument, which should allow for custom cleanup step.

Build it so:

docker build -t myapp .

and start it thus:

docker run -it --rm myapp

You could (re)build this image locally with:

docker build --no-cache -t anapsix/php https://github.com/anapsix/docker-php.git

About

Tiny Docker image with PHP + Composer over AlpineLinux

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published