diff --git a/PHP.Dockerfile b/PHP.Dockerfile index 664efd4..f692144 100644 --- a/PHP.Dockerfile +++ b/PHP.Dockerfile @@ -1,10 +1,20 @@ -FROM php:7.4-fpm +FROM php:7.4-apache RUN apt-get update RUN apt-get install -y git zip +# Set Apache Root +ENV APACHE_DOCUMENT_ROOT=/var/www/html/public +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 + +# Enable Some Apache Mod +RUN a2enmod rewrite headers + RUN docker-php-ext-install pdo pdo_mysql +RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" + # Composer COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer \ No newline at end of file diff --git a/README.md b/README.md index aa438f5..1f5c9c3 100755 --- a/README.md +++ b/README.md @@ -83,25 +83,25 @@ docker-compose -f docker-compose.dev.yml up -d ### Installing / Updating Dependencies ```bash -docker-compose -f docker-compose.dev.yml exec -w /srv todo composer install # Composer Install +docker-compose -f docker-compose.dev.yml exec -w /var/www/html todo composer install # Composer Install ``` ### Generate Key ```bash -docker-compose -f docker-compose.dev.yml exec -w /srv todo php artisan key:generate # Generate Key +docker-compose -f docker-compose.dev.yml exec -w /var/www/html todo php artisan key:generate # Generate Key ``` ### Database Migration ```bash -docker-compose -f docker-compose.dev.yml exec -w /srv todo php artisan migrate +docker-compose -f docker-compose.dev.yml exec -w /var/www/html todo php artisan migrate ``` ### Database Seed ```bash -docker-compose -f docker-compose.dev.yml exec -w /srv todo php artisan db:seed +docker-compose -f docker-compose.dev.yml exec -w /var/www/html todo php artisan db:seed ``` ### Shutdown Application @@ -113,7 +113,7 @@ docker-compose -f docker-compose.dev.yml down ### Updating `.env` ```bash -docker-compose -f docker-compose.dev.yml exec -w /srv todo php artisan config:cache +docker-compose -f docker-compose.dev.yml exec -w /var/www/html todo php artisan config:cache ``` ### Rebuilding Dockerfile diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 7c29215..d1115ea 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -4,16 +4,10 @@ services: build: context: . dockerfile: PHP.Dockerfile - volumes: - - "./:/srv" - - caddy: - image: caddy:2.5.0-alpine ports: - "80:80" volumes: - - "./Caddyfile:/etc/caddy/Caddyfile" - - "./:/srv" + - "./:/var/www/html" mysqldb: image: "bitnami/mysql:8.0"