Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Php7 #16

Open
wants to merge 20 commits into
base: php7
Choose a base branch
from
Open

Php7 #16

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
PHP_ZEND_EXTENSION="/usr/lib/php/20170718/xdebug.so"
PHP_XDEBUG_DEFAULT_ENABLE=0
PHP_XDEBUG_REMOTE_ENABLE=0
PHP_XDEBUG_REMOTE_HOST=127.0.0.1
PHP_XDEBUG_REMOTE_PORT=9001
PHP_XDEBUG_REMOTE_AUTO_START=0
PHP_XDEBUG_REMOTE_CONNECT_BACK=0
PHP_XDEBUG_IDEKEY=docker
PHP_XDEBUG_PROFILER_ENABLE=0
PHP_XDEBUG_PROFILER_OUTPUT_DIR=/tmp
35 changes: 26 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,49 @@
FROM ubuntu:16.04
MAINTAINER Iain Mckay "[email protected]"

RUN apt-get update && apt-get install -y software-properties-common python-software-properties && add-apt-repository ppa:ondrej/php && apt-get update && \
ENV COMPOSER_ALLOW_SUPERUSER 1
ENV PHP_ZEND_EXTENSION ${PHP_ZEND_EXTENSION:-"/usr/lib/php/20170718/xdebug.so"}
ENV PHP_XDEBUG_DEFAULT_ENABLE ${PHP_XDEBUG_DEFAULT_ENABLE:-1}
ENV PHP_XDEBUG_REMOTE_ENABLE ${PHP_XDEBUG_REMOTE_ENABLE:-1}
ENV PHP_XDEBUG_REMOTE_HOST ${PHP_XDEBUG_REMOTE_HOST:-"127.0.0.1"}
ENV PHP_XDEBUG_REMOTE_PORT ${PHP_XDEBUG_REMOTE_PORT:-9000}
ENV PHP_XDEBUG_REMOTE_AUTO_START ${PHP_XDEBUG_REMOTE_AUTO_START:-1}
ENV PHP_XDEBUG_REMOTE_CONNECT_BACK ${PHP_XDEBUG_REMOTE_CONNECT_BACK:-1}
ENV PHP_XDEBUG_IDEKEY ${PHP_XDEBUG_IDEKEY:-docker}
ENV PHP_XDEBUG_PROFILER_ENABLE ${PHP_XDEBUG_PROFILER_ENABLE:-0}
ENV PHP_XDEBUG_PROFILER_OUTPUT_DIR ${PHP_XDEBUG_PROFILER_OUTPUT_DIR:-"/tmp"}

RUN set -ex && \
apt-get update && apt-get install -y software-properties-common && LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php && apt-get update && \
apt-get install -y software-properties-common wget git curl && \
curl -sL https://deb.nodesource.com/setup_5.x | bash - && \
curl -sL https://deb.nodesource.com/setup_8.x | bash - && \
apt-get update && \
apt-get install -y --allow-unauthenticated graphviz phpunit nodejs \
php7.1-cli php7.1-dev php7.1-curl php7.1-gd php7.1-gmp php7.1-json php7.1-ldap php7.1-mysql php7.1-odbc php7.1-pgsql php7.1-pspell php7.1-readline php7.1-recode php7.1-sqlite3 php7.1-tidy php7.1-xml php7.1-xmlrpc php7.1-bcmath php7.1-bz2 php7.1-enchant php7.1-imap php7.1-interbase php7.1-intl php7.1-mbstring php7.1-mcrypt php7.1-soap php7.1-sybase php7.1-xsl php7.1-zip php-memcache php-memcached php-pear \
apt-get install -y --allow-unauthenticated vim graphviz phpunit nodejs \
php7.2-cli php7.2-dev php7.2-curl php7.2-gd php7.2-gmp php7.2-json php7.2-ldap php7.2-mysql php7.2-odbc php7.2-pgsql php7.2-pspell php7.2-readline php7.2-recode php7.2-sqlite3 php7.2-tidy php7.2-xml php7.2-xmlrpc php7.2-bcmath php7.2-bz2 php7.2-enchant php7.2-imap php7.2-interbase php7.2-intl php7.2-mbstring php7.2-soap php7.2-sybase php7.2-xsl php7.2-zip php-memcache php-memcached php-pear \
openjdk-8-jre libxext-dev libxrender-dev libxtst-dev && \
pecl install xdebug && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/*

COPY xdebug.ini /etc/php/7.2/mods-available/xdebug.ini

RUN useradd -m -s /bin/bash developer \
&& mkdir /home/developer/.PhpStorm2017.1 \
&& touch /home/developer/.PhpStorm2017.1/.keep \
&& mkdir /home/developer/.PhpStorm2018.2 \
&& touch /home/developer/.PhpStorm2018.2/.keep \
&& chown -R developer.developer /home/developer \
&& mkdir /opt/phpstorm \
&& wget -O - https://download.jetbrains.com/webide/PhpStorm-2017.1.tar.gz | tar xzf - --strip-components=1 -C "/opt/phpstorm"
&& wget -O - https://download.jetbrains.com/webide/PhpStorm-2018.2.3.tar.gz | tar xzf - --strip-components=1 -C "/opt/phpstorm"

RUN php -r "readfile('https://getcomposer.org/installer');" | php -- --install-dir=/usr/bin
RUN phpenmod curl gd gmp json ldap mysql odbc pgsql pspell readline recode snmp sqlite3 tidy xml xmlrpc bcmath bz2 enchant imap interbase intl mbstring mcrypt soap sybase xsl zip xdebug memcache memcached
RUN phpenmod curl gd gmp json ldap mysql odbc pgsql pspell readline recode sqlite3 tidy xml xmlrpc bcmath bz2 enchant imap interbase intl mbstring soap xsl zip xdebug memcache memcached
#RUN php5enmod mcrypt curl
RUN wget -c http://static.phpmd.org/php/latest/phpmd.phar -O /usr/bin/phpmd.phar && chmod +x /usr/bin/phpmd.phar
RUN pear install PHP_CodeSniffer
RUN npm install -g bower

COPY xdebug.ini /etc/php/7.2/cli/conf.d/20-xdebug.ini

USER developer
VOLUME /home/developer/.PhpStorm2017.1
VOLUME /home/developer/.PhpStorm2018.2
CMD /opt/phpstorm/bin/phpstorm.sh
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# docker-phpstorm

Jetbrains PhpStorm 2017.1 running inside a docker container. This project is derived from [`fgrehm/docker-netbeans`](https://github.com/fgrehm/docker-netbeans).
Jetbrains PhpStorm 2018.2 running inside a docker container. This project is derived from [`fgrehm/docker-netbeans`](https://github.com/fgrehm/docker-netbeans).

## Features

* PhpStorm 2017.1
* PHP 7.1
* PhpStorm 2018.2.3
* PHP 7.2
* composer
* graphviz

Expand All @@ -19,15 +19,19 @@ To launch PhpStorm we need to provide the current display and your X11 socket. Y
$ docker run -it --rm \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v ~/.PhpStorm2017.1:/home/developer/.PhpStorm2017.1 \
-v ~/.PhpStorm2018.2:/home/developer/.PhpStorm2018.2 \
-v ~/Projects:/workspace \
iainmckay/phpstorm:2017.1-php7
iainmckay/phpstorm:2018.2-php7
```

With this your configuration will be persisted to `/home/<user>/.PhpStorm2017.1` so that you don't lose it over subsequent runs. It also makes any sourcecode under `/home/<user>/Projects` available to PhpStorm. Inside the dockerized environment, it will be available through `/workspace`.
With this your configuration will be persisted to `/home/<user>/.PhpStorm2018.2` so that you don't lose it over subsequent runs. It also makes any sourcecode under `/home/<user>/Projects` available to PhpStorm. Inside the dockerized environment, it will be available through `/workspace`.

Note: Remember to change the ownership of the config directory on the host as it will be created as root if it does not already exist and PhpStorm won't be able to write to it.

## Xdebug

An environmental values for xdebug.ini configuration may be setup from an example .env.example and appending `--env <custom_env_file>` to the command

## Adding to your launcher

There is a desktop launcher provided in `support/launcher`. You should place `phpstorm.desktop` in `~/.local/share/applications` and place `phpstorm.png` in `~/.local/share/icons`.
Expand Down
2 changes: 1 addition & 1 deletion support/launcher/phpstorm.desktop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Desktop Entry]
Name=PhpStorm
Exec=sh -c "docker run --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v ~/.PhpStorm2016.3:/home/developer/.PhpStorm2016.3 -v ~/Projects:/workspace iainmckay/phpstorm:2016.3.1-php7"
Exec=sh -c "docker run --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v ~/.PhpStorm2018.2:/home/developer/.PhpStorm2018.2 -v ~/Projects:/workspace iainmckay/phpstorm:2018.2-php7"
Icon=phpstorm
Terminal=false
Type=Application
Expand Down
14 changes: 14 additions & 0 deletions xdebug.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[xdebug]
zend_extension=${PHP_ZEND_EXTENSION}
xdebug.default_enable=${PHP_XDEBUG_DEFAULT_ENABLE}
xdebug.remote_enable=${PHP_XDEBUG_REMOTE_ENABLE}
xdebug.remote_handler=dbgp
xdebug.remote_port=${PHP_XDEBUG_REMOTE_PORT}
xdebug.remote_host=${PHP_XDEBUG_REMOTE_HOST}
xdebug.remote_autostart=${PHP_XDEBUG_REMOTE_AUTO_START}
xdebug.remote_connect_back=${PHP_XDEBUG_REMOTE_CONNECT_BACK}
xdebug.idekey=${PHP_XDEBUG_IDEKEY}

; profiler
xdebug.profiler_enable = ${PHP_XDEBUG_PROFILER_ENABLE}
xdebug.profiler_output_dir = ${PHP_XDEBUG_PROFILER_OUTPUT_DIR}