Skip to content

Instantly share code, notes, and snippets.

@wobsoriano
Forked from amitavroy/Dockerfile
Last active August 18, 2019 02:27
Show Gist options
  • Save wobsoriano/6afd5ef2cfa82b8c1117441596610733 to your computer and use it in GitHub Desktop.
Save wobsoriano/6afd5ef2cfa82b8c1117441596610733 to your computer and use it in GitHub Desktop.
Docker setup with Laravel & MySQL
<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>
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
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