Created
August 20, 2020 23:37
-
-
Save IgorDePaula/ab106e166188f8012ffbd4a00190407b to your computer and use it in GitHub Desktop.
docker and docker-compose laravel app
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: | |
laravel_app: | |
container_name: "laravel_app" | |
build: | |
context: . | |
dockerfile: Dockerfile | |
restart: "always" | |
environment: | |
- APACHE_DOCUMENT_ROOT=/var/www/public | |
volumes: | |
- ./:/var/www | |
ports: | |
- "8900:80" | |
depends_on: | |
- laravel_db | |
links: | |
- laravel_db | |
laravel_db: | |
container_name: "laravel_db" | |
image: mysql | |
command: --default-authentication-plugin=mysql_native_password | |
restart: always | |
ports: | |
- "3306:3306" | |
volumes: | |
- ./.docker/.laravel_db:/var/lib/mysql | |
environment: | |
- MYSQL_RANDOM_ROOT_PASSWORD=true | |
- MYSQL_DATABASE=${DB_DATABASE} | |
- MYSQL_USER=${DB_USERNAME} | |
- MYSQL_PASSWORD=${DB_PASSWORD} |
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 composer:latest AS composer | |
FROM php:7.3-apache | |
RUN apt-get update && apt-get install -y \ | |
unzip \ | |
git \ | |
zip \ | |
nano \ | |
curl \ | |
zlib1g-dev \ | |
libzip-dev \ | |
&& docker-php-ext-install -j$(nproc) zip sockets pdo pdo_mysql mysqli | |
COPY --from=composer /usr/bin/composer /usr/bin/composer | |
WORKDIR /var/www | |
RUN a2enmod rewrite | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment