Giter VIP home page Giter VIP logo

docker-phan's Introduction

docker-phan

An installation of PHP7 and Phan in a super tiny Alpine Linux Docker image. The image is just 17 MB and runs interactively on the files outside your container, making it easy to statically analyze PHP code.

Motivations

Phan requires PHP7 and specific PHP extensions to be installed. PHP7 isn’t packaged yet for many Linux distributions and users would still need to compile and enable the extra PHP extensions.

By packaging Phan inside a Docker image, we can separate the runtime and configuration of the tool from your application’s environment and requirements.

Getting docker-phan

The easiest way to use docker-phan is to create a shell function for “phan” that makes makes it nearly transparent that phan is running inside Docker.

phan() { docker run -v $PWD:/mnt/src --rm -u "$(id -u):$(id -g)" cloudflare/phan:latest $@; return $?; }

(You may replace “latest” with a tagged Phan release to use a specific version of Phan.)

Running docker-phan

If you’re just getting started with Phan, you should follow Phan’s excellent Tutorial for Analyzing A Large Sloopy Code Base to setup the initial configuration for your project.

All of Phan’s command line flags can be passed to docker-phan.

Example

To create an “analysis.txt” in the current directory for farther processing

phan -po analysis.txt

Building

Docker images are built with the build script based on the awesome building and testing framework put into place by the docker-alpine contributors. See BUILD.md for more information.

License

BSD 2-Clause License

docker-phan's People

Contributors

bobvandevijver avatar darthsteven avatar fruitl00p avatar spencermalone avatar terinjokes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-phan's Issues

Utilize Docker's multi-stage builds

We should be able to utilize docker's multi-stage builds now, eliminating the need for pipeling the archive of the filesystem to stdout. This should also make building images less error prone.

How to get the latest Phan version

Hi,

I'm not sure how to get the latest phan version installed: currently it looks like I'm quite some commits behind. I start the check by running:

docker run --rm -v $PWD:/mnt/src cloudflare/phan:latest -k tests/phan/config.php

Can you tell me how I can get Phan to the latest version?

Doesn't work with checkstyle output mode

When I tried to use this with the checkstyle output mode, it complained that the DOMDocument class was missing, presumably because the version of PHP installed in this image is so minimal that it doesn't include the DOM extension.

pcntl extension is missing/not enabled in image

Hi,

thank you for this cool tiny image.
While playing with it, I have discovered that it is impossible to use -j(aka --processes) option.
Staketrace should be self-explanatory

$ docker run -v $PWD:/mnt/src --rm -u "$(id -u):$(id -g)" cloudflare/phan:latest -j=2
Error: Call to undefined function Phan\pcntl_fork() in /opt/phan/src/Phan/ForkPool.php:53
Stack trace:
#0 /opt/phan/src/Phan/Phan.php(160): Phan\ForkPool->__construct(2, Array, Object(Closure), Object(Closure), Object(Closure))
#1 /opt/phan/src/phan.php(42): Phan\Phan::analyzeFileList(Object(Phan\CodeBase), Array)
#2 /opt/phan/phan(2): require_once('/opt/phan/src/p...')
#3 {main}

Automatic trigger new builds

As discussed in #7, this image is not updated at a regular interval. However, as Phan is quite active in development, it should create more images more often.

Automatic builds should be possible with Travis CI (and possibly for free).

Edit: Currently I'm working in my fork to add Travis Support (Kick-In#1), which is already building the newest edge image. Travis has indeed a free option for opensource project, and also supports cron builds.
When finished, I will submit a PR for this repository, but someone here should have configured travis first for it to work correctly.

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.