Dockerfile 2.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
FROM ubuntu:18.04

ENV BOOT2DOCKER_ID 1000
ENV BOOT2DOCKER_GID 50

# Tweaks to give Apache/PHP write permissions to the app
RUN usermod -u ${BOOT2DOCKER_ID} www-data && \
    usermod -G staff www-data && \
    useradd -r mysql && \
    usermod -G staff mysql

RUN groupmod -g $(($BOOT2DOCKER_GID + 10000)) $(getent group $BOOT2DOCKER_GID | cut -d: -f1)
RUN groupmod -g ${BOOT2DOCKER_GID} staff

# Install packages
ENV DEBIAN_FRONTEND noninteractive
RUN set -eux; \
    apt-get update; \
19
    apt-get install -y --no-install-recommends \
20 21 22 23 24 25 26 27 28 29 30 31 32 33
        supervisor \
        wget \
        apache2 \
        mariadb-server \
        php \
        php-xml \
        php-mysql \
        php-pdo \
        php-gd \
        php-intl \
        php-mbstring \
        php-zip \
        libapache2-mod-php \
        curl \
34 35 36 37 38 39 40 41 42 43 44 45
        gnupg \
        ca-certificates \
        libgtk2.0-0 \
        libgtk-3-0 \
        libnotify-dev \
        libgconf-2-4 \
        libnss3 \
        libxss1 \
        libasound2 \
        libxtst6 \
        xauth \
        xvfb \
46 47 48 49
        jq; \
        echo "ServerName localhost" >> /etc/apache2/apache2.conf;

# Install yarn
50 51 52 53 54 55 56
ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn
RUN set -eux;\
    apt-get update && apt-get install -y gnupg; \
    curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -; \
    echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list; \
    apt-get update; \
    apt-get install -y --no-install-recommends nodejs yarn;
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88

# Add image configuration and scripts
ADD files/start-apache2.sh /start-apache2.sh
ADD files/start-mysqld.sh /start-mysqld.sh
ADD files/run.sh /run.sh
RUN chmod 755 /*.sh
ADD files/supervisord.conf /etc/supervisor/conf.d/supervisord.conf

# Remove pre-installed database
RUN rm -rf /var/lib/mysql

# Add MySQL utils
ADD files/create_mysql_users.sh /create_mysql_users.sh

# Add composer
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
    php composer-setup.php && \
    php -r "unlink('composer-setup.php');" && \
    mv composer.phar /usr/local/bin/composer

# config to enable .htaccess
ADD files/apache_default /etc/apache2/sites-available/000-default.conf
RUN a2enmod rewrite

# Configure /app folder with sample app
RUN mkdir -p /app && rm -fr /var/www/html && ln -s /app /var/www/html

#Environment variables to configure php
ENV PHP_UPLOAD_MAX_FILESIZE 10M
ENV PHP_POST_MAX_SIZE 10M
ENV PHP_VERSION 7.2

89 90 91
# Install Cypress
RUN yarn global add --pure-lockfile cypress@4.11.0;

92 93 94
WORKDIR /app

CMD ["/run.sh"]