|
|
- FROM php:7.2-apache
-
- RUN apt-get update
-
- # 1. development packages
- RUN apt-get install -y \
- git \
- zip \
- vim \
- curl \
- sudo \
- unzip \
- libicu-dev \
- libbz2-dev \
- libpng-dev \
- libjpeg-dev \
- libmcrypt-dev \
- libreadline-dev \
- libfreetype6-dev \
- g++
-
- # 2. apache configs + document root
- ENV APACHE_DOCUMENT_ROOT=/var/www/html
- RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
- RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
-
- # 3. mod_rewrite for URL rewrite and mod_headers for .htaccess extra headers like Access-Control-Allow-Origin-
- RUN a2enmod rewrite headers
-
- # 4. start with base php config, then add extensions
- RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
-
- RUN docker-php-ext-install \
- bz2 \
- intl \
- iconv \
- bcmath \
- opcache \
- calendar \
- mbstring \
- pdo_mysql \
- zip
-
- # 5. composer
- # COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
-
- # 6. we need a user with the same UID/GID with host user
- # so when we execute CLI commands, all the host file's ownership remains intact
- # otherwise command from inside container will create root-owned files and directories
-
- #WORKDIR /var/www/html
- #ADD . /var/www/html
-
- COPY ./ /var/www/html
- RUN chown -R www-data:www-data /var/www/html
-
- #USER root
-
- #ARG uid
- #RUN useradd -G www-data,root -u $uid -d /home/soumya soumya
- #RUN mkdir -p /var/www/.composer && \
- # chown -R www-data:www-data /var/www
-
- #RUN chmod -R 777 /var/www
-
- #EXPOSE 8000
|