Skip to content

Instantly share code, notes, and snippets.

@donpandix
Last active September 25, 2022 16:23
Show Gist options
  • Save donpandix/0069b9ce47574545ddfc522bf8a84a1c to your computer and use it in GitHub Desktop.
Save donpandix/0069b9ce47574545ddfc522bf8a84a1c to your computer and use it in GitHub Desktop.
Creación de un Docker con PHP7 y configurado para ejecutar Laravel

Intrucciones para la configuración del ambiente PHP7 para Laravel

Se deben descargar ambos archivos Dockerfile y vhost.conf en la raiz de la carpeta que será usada para el desarrollo de la aplicación web, luego de ello se debe ejecutar la siguiente instrucción por terminal

docker build
FROM php:7.4-apache
USER root
WORKDIR /var/www/html
# Permite URL amigables
RUN a2enmod rewrite
# Actualiza el ambiente con las ultimas versiones
RUN apt-get update && apt-get upgrade -y
# Aplicacion editor de texto
RUN apt-get install nano -y
# Instala conector MYSQL, ZIP
RUN docker-php-ext-install mysqli \
&& docker-php-ext-enable mysqli \
&& apt-get install -y --no-install-recommends libzip-dev zlib1g-dev \
&& docker-php-ext-install zip \
&& docker-php-ext-enable zip
RUN apt-get install -y --no-install-recommends libicu67 libicu-dev \
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl \
&& docker-php-ext-enable intl
# Instala la libreria GD
RUN apt-get install -y --no-install-recommends libpng-dev libjpeg-dev libwebp-dev libfreetype6-dev libgd-dev \
&& docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ --with-webp=/usr/include/ \
&& docker-php-ext-install gd \
&& docker-php-ext-enable gd
# Instala PDO Mysql
RUN apt-get install -y --no-install-recommends default-mysql-client \
&& docker-php-ext-install pdo_mysql \
&& docker-php-ext-enable pdo_mysql
COPY ./vhost.conf /etc/apache2/sites-available/000-default.conf
# Instala el composer dentro del ambiente
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
<VirtualHost *:80>
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