docker-compose.yml
services:
laravel-docker:
container_name: laravel-docker
build: .
volumes:
- ./laravel-app:/var/www/html
ports:
- 9000:80
mysql_db:
image: mysql:latest
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: taravel_docker
ports:
- 3306:3306
phpmyadmin:
image: phpmyadmin:latest
ports:
- 9001:80
environment:
- PMA_ARBITRARY=1
Dockerfile
FROM php:8.1.0-apache
WORKDIR /var/www/html
# Mod Rewrite
RUN a2enmod rewrite
# Linux Library
RUN apt-get update -y && apt-get install -y \
libicu-dev \
libmariadb-dev \
unzip zip \
zlib1g-dev \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev
# Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# PHP Extension
RUN docker-php-ext-install gettext intl pdo_mysql gd
RUN docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd
run
docker-compose build
docker-compose up
Makefile
setup:
@make build
@make up
@make composer-update
build:
docker-compose build --no-cache --force-rm
stop:
docker-compose stop
up:
docker-compose up -d
composer-update:
docker exec laravel-docker bash -c "composer update"
data:
docker exec laravel-docker bash -c "php artisan migrate"
docker exec laravel-docker bash -c "php artisan db:seed"
composer create-project laravel/laravel .
make composer-update
make data
Top comments (0)