Start of Dockerization
This commit is contained in:
parent
12c5e630b1
commit
09e41822c9
6 changed files with 126 additions and 46 deletions
|
|
@ -1,46 +0,0 @@
|
||||||
APP_NAME=Laravel
|
|
||||||
APP_ENV=local
|
|
||||||
APP_KEY=
|
|
||||||
APP_DEBUG=true
|
|
||||||
APP_URL=http://localhost
|
|
||||||
|
|
||||||
LOG_CHANNEL=stack
|
|
||||||
|
|
||||||
DB_CONNECTION=mysql
|
|
||||||
DB_HOST=127.0.0.1
|
|
||||||
DB_PORT=3306
|
|
||||||
DB_DATABASE=laravel
|
|
||||||
DB_USERNAME=root
|
|
||||||
DB_PASSWORD=
|
|
||||||
|
|
||||||
BROADCAST_DRIVER=log
|
|
||||||
CACHE_DRIVER=file
|
|
||||||
QUEUE_CONNECTION=sync
|
|
||||||
SESSION_DRIVER=file
|
|
||||||
SESSION_LIFETIME=120
|
|
||||||
|
|
||||||
REDIS_HOST=127.0.0.1
|
|
||||||
REDIS_PASSWORD=null
|
|
||||||
REDIS_PORT=6379
|
|
||||||
|
|
||||||
MAIL_MAILER=smtp
|
|
||||||
MAIL_HOST=smtp.mailtrap.io
|
|
||||||
MAIL_PORT=2525
|
|
||||||
MAIL_USERNAME=null
|
|
||||||
MAIL_PASSWORD=null
|
|
||||||
MAIL_ENCRYPTION=null
|
|
||||||
MAIL_FROM_ADDRESS=null
|
|
||||||
MAIL_FROM_NAME="${APP_NAME}"
|
|
||||||
|
|
||||||
AWS_ACCESS_KEY_ID=
|
|
||||||
AWS_SECRET_ACCESS_KEY=
|
|
||||||
AWS_DEFAULT_REGION=us-east-1
|
|
||||||
AWS_BUCKET=
|
|
||||||
|
|
||||||
PUSHER_APP_ID=
|
|
||||||
PUSHER_APP_KEY=
|
|
||||||
PUSHER_APP_SECRET=
|
|
||||||
PUSHER_APP_CLUSTER=mt1
|
|
||||||
|
|
||||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
|
||||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
|
||||||
36
motorradig/Dockerfile.dev
Normal file
36
motorradig/Dockerfile.dev
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
FROM php:7.2-fpm
|
||||||
|
|
||||||
|
# Arguments defined in docker-compose.yml
|
||||||
|
ARG user
|
||||||
|
ARG uid
|
||||||
|
|
||||||
|
# Install system dependencies
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
git \
|
||||||
|
curl \
|
||||||
|
libpng-dev \
|
||||||
|
libonig-dev \
|
||||||
|
libxml2-dev \
|
||||||
|
zip \
|
||||||
|
unzip \
|
||||||
|
libzip-dev \
|
||||||
|
-y mariadb-client
|
||||||
|
|
||||||
|
# Clear cache
|
||||||
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install PHP extensions
|
||||||
|
RUN docker-php-ext-install zip mysqli pdo_mysql mbstring exif pcntl bcmath gd && docker-php-ext-enable mysqli
|
||||||
|
|
||||||
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||||
|
|
||||||
|
# Create system user to run Composer and Artisan Commands
|
||||||
|
RUN useradd -G www-data,root -u $uid -d /home/$user $user
|
||||||
|
RUN mkdir -p /home/$user/.composer && \
|
||||||
|
chown -R $user:$user /home/$user
|
||||||
|
|
||||||
|
# Set working directory
|
||||||
|
WORKDIR /var/www
|
||||||
|
|
||||||
|
USER $user
|
||||||
|
|
||||||
58
motorradig/docker-compose.yml
Normal file
58
motorradig/docker-compose.yml
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
version: "3.7"
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
build:
|
||||||
|
args:
|
||||||
|
user: sammy
|
||||||
|
uid: 1000
|
||||||
|
context: ./
|
||||||
|
dockerfile: Dockerfile.dev
|
||||||
|
working_dir: /var/www/
|
||||||
|
environment:
|
||||||
|
- COMPOSER_MEMORY_LIMIT=-1
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
volumes:
|
||||||
|
- ./:/var/www
|
||||||
|
networks:
|
||||||
|
- lahmi
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: mysql:5.7
|
||||||
|
environment:
|
||||||
|
MYSQL_DATABASE: ${DB_DATABASE}
|
||||||
|
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
|
||||||
|
MYSQL_PASSWORD: ${DB_PASSWORD}
|
||||||
|
MYSQL_USER: ${DB_USERNAME}
|
||||||
|
SERVICE_TAGS: dev
|
||||||
|
SERVICE_NAME: mysql
|
||||||
|
volumes:
|
||||||
|
- dbdata:/var/lib/mysql
|
||||||
|
- ./docker-compose/mysql/my.cnf:/etc/mysql/my.cnf
|
||||||
|
- ./docker-compose/mysql/init:/docker-entrypoint-initdb.d
|
||||||
|
ports:
|
||||||
|
- 3306:3306
|
||||||
|
networks:
|
||||||
|
- lahmi
|
||||||
|
|
||||||
|
nginx:
|
||||||
|
image: nginx:alpine
|
||||||
|
ports:
|
||||||
|
- 8005:80
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
- app
|
||||||
|
volumes:
|
||||||
|
- ./:/var/www
|
||||||
|
- ./docker-compose/nginx:/etc/nginx/conf.d/
|
||||||
|
networks:
|
||||||
|
- lahmi
|
||||||
|
|
||||||
|
networks:
|
||||||
|
lahmi:
|
||||||
|
driver: bridge
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
dbdata:
|
||||||
|
driver: local
|
||||||
|
|
||||||
7
motorradig/docker-compose/mysql/init/01-databases.sql
Normal file
7
motorradig/docker-compose/mysql/init/01-databases.sql
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# create databases
|
||||||
|
CREATE DATABASE IF NOT EXISTS `local_laravel`;
|
||||||
|
|
||||||
|
# create local_developer user and grant rights
|
||||||
|
CREATE USER 'local_developer'@'db' IDENTIFIED BY 'secret';
|
||||||
|
GRANT ALL PRIVILEGES ON *.* TO 'local_developer'@'%';
|
||||||
|
|
||||||
4
motorradig/docker-compose/mysql/my.cnf
Normal file
4
motorradig/docker-compose/mysql/my.cnf
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
[mysqld]
|
||||||
|
general_log = 1
|
||||||
|
general_log_file = /var/lib/mysql/general.log
|
||||||
|
|
||||||
21
motorradig/docker-compose/nginx/default.conf
Normal file
21
motorradig/docker-compose/nginx/default.conf
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
index index.php index.html;
|
||||||
|
error_log /var/log/nginx/error.log;
|
||||||
|
access_log /var/log/nginx/access.log;
|
||||||
|
root /var/www/public;
|
||||||
|
location ~ \.php$ {
|
||||||
|
try_files $uri =404;
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
|
fastcgi_pass app:9000;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
|
}
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php?$query_string;
|
||||||
|
gzip_static on;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue