# Create a base Ubuntu image to build upon
# docker build --rm -f Dockerfile-72 -t composer:7.2 .
FROM ubuntu:16.04
MAINTAINER Richard Morgan <r_morgan@sympatico.ca>

WORKDIR /opt/project

# set terminal variable so that tools such as nano and htop work
# this is not needed in prod containers, but is useful for devs
ENV TERM=xterm

RUN apt-get update && apt-get install -y software-properties-common python-software-properties \
  && LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php \
  && apt-get update && apt-get install -y \
    curl nano sed libwww-perl htop ca-certificates \
    php7.2 php-cli php-fpm php-curl php-pear php-mcrypt php-zip php-mbstring php-xml \
    php-pgsql php-redis php-soap\
    git \
    \
  && apt-cache pkgnames | grep php7.2 \
  && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
  && php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
  && php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
  && composer global require franzl/studio\
  && useradd -u 1000 -d /home/user user \
  && mkdir -p /home/user/.composer && chmod -R 777 /home/user/.composer

ENTRYPOINT ["/usr/local/bin/composer"]
