feat: apache dev mode

This commit is contained in:
Supan Adit Pratama 2022-05-02 17:44:29 +07:00
parent 730763a58a
commit 8a254b4176
3 changed files with 17 additions and 13 deletions

View File

@ -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

View File

@ -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

View File

@ -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"