Skip to content

Instantly share code, notes, and snippets.

@Johannestegner
Last active September 3, 2020 06:59
Show Gist options
  • Select an option

  • Save Johannestegner/fc7f235560345570ea17bdba3ea34098 to your computer and use it in GitHub Desktop.

Select an option

Save Johannestegner/fc7f235560345570ea17bdba3ea34098 to your computer and use it in GitHub Desktop.
Laravel docker-compose setup.
APP_NAME=my-appity-app
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=database
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=username
DB_PASSWORD=abc123
BROADCAST_DRIVER=redis
CACHE_DRIVER=redis
QUEUE_CONNECTION=redis
SESSION_DRIVER=redis
SESSION_LIFETIME=120
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=smtp
MAIL_PORT=8025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=test@the-app.com
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=abc123321cba
AWS_SECRET_ACCESS_KEY=321cbaabc123
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=primary-bucket
AWS_ENDPOINT=https://minio:9000
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}"
version: '3.7'
services:
fpm:
image: registry.gitlab.com/jitesoft/dockerfiles/php-fpm:7.4
volumes:
- ./:/var/www/html
database:
image: mariadb:latest
volumes:
- database:/var/lib/mysql
env_file: .env
environment:
- MYSQL_RANDOM_ROOT_PASSWORD=yes
- MYSQL_USER=${DB_USERNAME}
- MYSQL_PASSWORD=${DB_PASSWORD}
- MYSQL_DATABASE=${DB_DATABASE}
ports:
- "3306:3306"
web:
image: registry.gitlab.com/jitesoft/dockerfiles/nginx:latest
environment:
SERVER_ROOT: /var/www/html/public
ports:
- "80:80"
volumes:
- ./:/var/www/html
- ./nginx.conf:/usr/local/default.template
redis:
image: redis:latest
command: redis-server --port 6379 --appendonly yes
volumes:
- redis:/data
ports:
- "6379:6379"
minio:
image: minio/minio
command: server /data
env_file: .env
environment:
- MINIO_ACCESS_KEY=${AWS_ACCESS_KEY_ID}
- MINIO_SECRET_KEY=${AWS_SECRET_ACCESS_KEY}
volumes:
- minio:/data
ports:
- "9000:9000"
smtp:
image: mailhog/mailhog
ports:
- "8025:8025"
volumes:
database:
driver: local
redis:
driver: local
minio:
driver: local
# This is only for dev, NOT prod.
upstream fpm-backend {
server fpm:9000;
}
server {
listen 80;
root /var/www/html/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
server_tokens off;
fastcgi_pass fpm-backend;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
server_tokens off;
expires 10d;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment