Last active
September 18, 2023 04:48
-
-
Save System-Glitch/c53ca30a579dc60c7ea6333a40caec2c to your computer and use it in GitHub Desktop.
Docker-compose for Laravel + MariaDB development
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
php: | |
build: . | |
networks: | |
- backend | |
expose: | |
- "9000" | |
volumes: | |
- .:/var/www/html | |
nginx: | |
image: nginx:mainline-alpine | |
networks: | |
- backend | |
ports: | |
- '8080:8080' | |
restart: on-failure | |
volumes: | |
- .:/var/www/html | |
- ./nginx_config.conf:/etc/nginx/conf.d/site.conf | |
links: | |
- php | |
depends_on: | |
- php | |
mariadb: | |
image: mariadb | |
environment: | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_DATABASE: db_name | |
MYSQL_USER: db_user | |
MYSQL_PASSWORD: secret | |
networks: | |
- backend | |
ports: | |
- '3306:3306' | |
restart: on-failure | |
volumes: | |
- databaseVolume:/var/lib/mysql | |
volumes: | |
databaseVolume: {} | |
networks: | |
backend: | |
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:7.2-fpm | |
RUN apt-get update && apt-get install -y \ | |
git \ | |
zip \ | |
curl \ | |
sudo \ | |
unzip \ | |
libicu-dev \ | |
libbz2-dev \ | |
libpng-dev \ | |
libjpeg-dev \ | |
libmcrypt-dev \ | |
libreadline-dev \ | |
libfreetype6-dev | |
RUN docker-php-ext-install \ | |
bz2 \ | |
intl \ | |
iconv \ | |
bcmath \ | |
opcache \ | |
calendar \ | |
mbstring \ | |
pdo_mysql \ | |
zip | |
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer | |
CMD ["sh", "-c", "chown -R www-data:www-data /var/www/html/storage && cd /var/www/html && composer install && php artisan key:generate && php-fpm"] | |
EXPOSE 9000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 8080 default_server; | |
listen [::]:8080 default_server; | |
index index.php; | |
server_name digitick.local; | |
error_log /var/log/nginx/error.log; | |
access_log /var/log/nginx/access.log; | |
root /var/www/html/public; | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass php: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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment