Skip to content

Commit

Permalink
Init commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
zsolt258 committed Jul 6, 2021
1 parent 4221141 commit 2abf3f6
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,10 @@

# Embedded web-server pid file
/.web-server-pid

/.idea/modules.xml
/.idea/vcs.xml
/.idea/Todo.iml
/.idea/.gitignore
/mariadb/
/project/
56 changes: 56 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
version: '3'

networks:
todo-app:

services:

todoapp-nginx-service:
image: nginx:latest
container_name: todoapp-nginx-container
ports:
- "8180:80"
volumes:
- ./project:/var/www/project
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
depends_on:
- todoapp-fpm8-service
networks:
- todo-app

todoapp-fpm8-service:
build:
context: .
dockerfile: ./php/Dockerfile
container_name: todoapp-fpm8-container
ports:
- "9100:9000"
volumes:
- ./project:/var/www/project
networks:
- todo-app

todoapp-node-service:
image: node:latest
container_name: todoapp-node-container
volumes:
- ./project:/var/www/project
working_dir: /var/www/project
networks:
- todo-app

todoapp-mariadb-service:
image: mariadb:latest
container_name: todoapp-mariadb-container
ports:
- "3310:3306"
volumes:
- ./mariadb/database:/var/lib/mysql:rw
restart: always
environment:
MYSQL_USER: root
MYSQL_ROOT_PASSWORD: pass
MYSQL_PASSWORD: pass
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
networks:
- todo-app
63 changes: 63 additions & 0 deletions nginx/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
server {
server_name localhost;
root /var/www/project/public;
error_log /var/log/nginx/project_error.log;
access_log /var/log/nginx/project_access.log;
listen 80;

client_max_body_size 20G;
client_body_timeout 300s;
client_body_in_file_only clean;
client_body_buffer_size 16K;
client_body_temp_path /tmp;

location / {
# try to serve file directly, fallback to index.php
try_files $uri /index.php$is_args$args;
}

# optionally disable falling back to PHP script for the asset directories;
# nginx will return a 404 error when files are not found instead of passing the
# request to Symfony (improves performance but Symfony's 404 page is not displayed)
# location /bundles {
# try_files $uri =404;
# }

location ~ ^/index\.php(/|$) {
fastcgi_pass todoapp-fpm8-service:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;

# optionally set the value of the environment variables used in the application
# fastcgi_param APP_ENV prod;
# fastcgi_param APP_SECRET <app-secret-id>;
# fastcgi_param DATABASE_URL "mysql://db_user:db_pass@host:3306/db_name";

# When you are using symlinks to link the document root to the
# current version of your application, you should pass the real
# application path instead of the path to the symlink to PHP
# FPM.
# Otherwise, PHP's OPcache may not properly detect changes to
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
# for more information).
# Caveat: When PHP-FPM is hosted on a different machine from nginx
# $realpath_root may not resolve as you expect! In this case try using
# $document_root instead.
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
# Prevents URIs that include the front controller. This will 404:
# http://domain.tld/index.php/some-path
# Remove the internal directive to allow URIs like this
internal;
}

# return 404 for all other php files not matching the front controller
# this prevents access to other php files you don't want to be accessible.
location ~ \.php$ {
return 404;
}


}
21 changes: 21 additions & 0 deletions php/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM php:8-fpm

WORKDIR /var/www/project

RUN apt-get update && apt-get install -y zlib1g-dev g++ git libicu-dev zip libzip-dev zip \
&& docker-php-ext-install intl opcache pdo pdo_mysql \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug \
&& pecl install apcu \
&& docker-php-ext-enable apcu \
&& docker-php-ext-configure zip \
&& docker-php-ext-install zip \
&& rm -rf /tmp/pear \
&& chmod -R 777 /var/www/project \
&& usermod -u 1000 www-data

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN curl -sS https://get.symfony.com/cli/installer | bash
RUN mv /root/.symfony/bin/symfony /usr/local/bin/symfony


0 comments on commit 2abf3f6

Please sign in to comment.