Skip to content

Instantly share code, notes, and snippets.

@isluewell
Last active September 17, 2019 00:11
Show Gist options
  • Save isluewell/05099d128f99f28eb85a9ac7c34707bc to your computer and use it in GitHub Desktop.
Save isluewell/05099d128f99f28eb85a9ac7c34707bc to your computer and use it in GitHub Desktop.
Php 7.2 for Laravel with Apache2
version: '3'
services:
web:
build: .
ports:
- "5000:80"
volumes:
- ../:/var/www/html
FROM ubuntu:18.04
LABEL maintainer="support@luewell.com"
MAINTAINER support@luewell.com
EXPOSE 80
EXPOSE 443
RUN apt-get update && apt-get dist-upgrade -y
RUN apt-get install -y software-properties-common curl git zip unzip apt-utils htop nano bash-completion
RUN add-apt-repository -y ppa:ondrej/php && apt-get update -y
RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y apache2 php7.2 libapache2-mod-php7.2 && service apache2 restart
RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y php7.2-curl php7.2-gd php-pear php7.2-imagick php7.2-pdo \
php7.2-mbstring php7.2-pgsql php7.2-mysql php7.2-sqlite3 php7.2-zip php7.2-gmp php7.2-bcmath \
php7.2-common php7.2-xml php7.2-sybase php7.2-imap php-memcache php7.2-ps mcrypt php7.2-pspell \
php7.2-recode php7.2-snmp php7.2-tidy php7.2-xmlrpc
RUN a2enmod rewrite headers proxy proxy_http proxy_wstunnel && service apache2 restart
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
RUN groupadd -r luewell -g 1000 && useradd -u 1000 -r -g luewell -m -d /home/luewell -s /sbin/nologin -c "Luewell" luewell && \
chmod 755 /home/luewell
RUN echo "luewell:lu3wel1" | chpasswd && usermod -aG sudo luewell
RUN chown -R luewell:www-data /var/www && chmod -R 755 /var/www && rm /var/www/html/index.html
WORKDIR /var/www/html
USER luewell
RUN composer && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
COPY vhost.conf /etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80>
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot "/var/www/html/public"
<Directory "/var/www/html/">
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment