-
-
Save wobsoriano/6afd5ef2cfa82b8c1117441596610733 to your computer and use it in GitHub Desktop.
Docker setup with Laravel & MySQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerName localhost | |
ServerAdmin webmaster@localhost | |
DocumentRoot /var/www/app/public | |
ErrorLog ${APACHE_LOG_DIR}/error.log | |
CustomLog ${APACHE_LOG_DIR}/access.log combined | |
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
web: | |
container_name: ${APP_NAME}_web | |
build: | |
context: ./docker/web | |
ports: | |
- 9000:80 | |
restart: on-failure | |
volumes: | |
- ./:/var/www/app | |
depends_on: | |
- db | |
networks: | |
- asgard | |
db: | |
container_name: ${APP_NAME}_db | |
image: mysql:5.7 | |
ports: | |
- 3306:3306 | |
restart: on-failure | |
volumes: | |
- ./mysqldata:/var/lib/mysql | |
environment: | |
- MYSQL_ROOT_PASSWORD=secret | |
- MYSQL_DATABASE=yourdatabase | |
- MYSQL_USER=yourusername | |
- MYSQL_PASSWORD=yourpassword | |
networks: | |
- asgard | |
pma: | |
container_name: phpmyadmin | |
image: phpmyadmin/phpmyadmin:edge | |
ports: | |
- 8080:80 | |
restart: on-failure | |
depends_on: | |
- db | |
networks: | |
- asgard | |
networks: | |
asgard: | |
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:7.2.10-apache-stretch | |
RUN apt-get update -yqq && \ | |
apt-get install -y apt-utils zip unzip && \ | |
apt-get install -y nano && \ | |
apt-get install -y libzip-dev && \ | |
a2enmod rewrite && \ | |
docker-php-ext-install pdo pdo_mysql && \ | |
docker-php-ext-configure zip --with-libzip && \ | |
docker-php-ext-install zip && \ | |
rm -rf /var/lib/apt/lists/* | |
RUN php -r "readfile('http://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer | |
COPY default.conf /etc/apache2/sites-enabled/000-default.conf | |
WORKDIR /var/www/app | |
CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"] | |
EXPOSE 80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment