Last active
September 28, 2024 19:54
-
-
Save harmlessprince/27261938503099ec45bf7e056ffb8c59 to your computer and use it in GitHub Desktop.
Docker compose laravel configs
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 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; | |
} | |
} |
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.8' | |
services: | |
# PHP Service container | |
laravel_eleven_app: | |
platform: linux/amd64 | |
build: | |
args: | |
user: laravel_eleven_user | |
uid: 1000 | |
context: .. | |
dockerfile: ../Dockerfile | |
image: laravel_eleven_app_image | |
container_name: laravel_eleven_app | |
restart: unless-stopped | |
depends_on: | |
- laravel_eleven_app_mysql | |
working_dir: /var/www | |
volumes: | |
- ./:/var/www | |
networks: | |
- laravel_eleven_app_network | |
#nginx service | |
laravel_eleven_webserver: | |
platform: linux/amd64 | |
image: nginx:alpine | |
container_name: laravel_eleven_webserver_container | |
restart: unless-stopped | |
ports: | |
- "6162:80" | |
depends_on: | |
- laravel_eleven_app | |
volumes: | |
- ./:/var/www | |
- ./docker-compose/nginx/:/etc/nginx/conf.d | |
networks: | |
- laravel_eleven_app_network | |
#mysql service | |
laravel_eleven_app_mysql: | |
platform: linux/amd64 | |
image: mysql:5.7.22 | |
container_name: laravel_eleven_app_mysql_container | |
restart: unless-stopped | |
ports: | |
- "3337:3306" | |
environment: | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_DATABASE: laravel_eleven_db | |
MYSQL_USER: laravel_eleven_user | |
MYSQL_PASSWORD: password | |
volumes: | |
- laravel_eleven_mysql_data:/var/lib/mysql | |
networks: | |
- laravel_eleven_app_network | |
laravel_eleven_phpmyadmin: | |
image: phpmyadmin:5.2.1-apache | |
container_name: laravel_eleven_phpmyadmin_container | |
restart: unless-stopped | |
ports: | |
- "8383:80" | |
environment: | |
PMA_HOST: laravel_eleven_app_mysql | |
PMA_PORT: 3306 | |
PMA_USER: root | |
PMA_PASSWORD: password | |
depends_on: | |
- laravel_eleven_app_mysql | |
networks: | |
- laravel_eleven_app_network | |
laravel_eleven_redis: | |
image: redis:7.2-alpine | |
container_name: laravel_eleven_redis_container | |
ports: | |
- "7379:6379" | |
networks: | |
- laravel_eleven_app_network | |
volumes: | |
laravel_eleven_mysql_data: | |
driver: local | |
networks: | |
laravel_eleven_app_network: | |
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:8.3-fpm | |
ARG user | |
ARG uid | |
RUN apt-get update && apt-get install -y \ | |
git \ | |
curl \ | |
libpng-dev \ | |
libonig-dev \ | |
libxml2-dev \ | |
zip \ | |
unzip | |
# Clear cache(optional) | |
RUN apt-get clean && rm -rf /var/lib/apt/lists/* | |
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd | |
# install composer | |
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer | |
RUN useradd -u $uid -ms /bin/bash -g www-data $user | |
COPY . /var/www | |
COPY --chown=$user:www-data . /var/www | |
USER $user | |
EXPOSE 9000 | |
CMD ["php-fpm"] |
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
[mysqld] | |
general_log = 1 | |
general_log_file = /var/lib/mysql/general.log |
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
upload_max_filesize=40M | |
post_max_size=40M |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment