https://github.com/anapsix/docker-php
Tiny Docker image with PHP + Composer over AlpineLinux
https://github.com/anapsix/docker-php
Last synced: 10 months ago
JSON representation
Tiny Docker image with PHP + Composer over AlpineLinux
- Host: GitHub
- URL: https://github.com/anapsix/docker-php
- Owner: anapsix
- Created: 2015-06-23T16:49:40.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-09-21T18:37:20.000Z (over 10 years ago)
- Last Synced: 2025-01-24T20:18:26.023Z (11 months ago)
- Language: Shell
- Size: 172 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## anapsix/php
42MB container image with basic PHP 5.6 installation and Composer,
based on [AlpineLinux](http://alpinelinux.org).
If you need to run PHP scripts inside containers,
but don't want the bulk of Ubuntu..
[](https://travis-ci.org/anapsix/docker-php)
[](https://imagelayers.io/?images=anapsix/php:latest)
## 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](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