diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..93b18ee --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +www/composer.lock +!.gitignore \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 4096410..0000000 --- a/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM php:7.2.0-fpm -LABEL Eakkabin Jaikeawma - -RUN apt-get update && apt-get install -y curl git --no-install-recommends \ - && docker-php-ext-install -j$(nproc) iconv mysqli pdo pdo_mysql mbstring \ - && apt-get clean && apt-get autoremove \ - && rm -r /var/lib/apt/lists/* && rm -rf /tmp/* /var/tmp/* - -COPY ./php7-ini/20-phalcon.ini /usr/local/etc/php/conf.d/20-phalcon.ini -COPY ./php7-ini/20-mongodb.ini /usr/local/etc/php/conf.d/20-mongodb.ini -COPY ./php7-ext/phalcon-v3.3.0.so /usr/local/lib/php/extensions/no-debug-non-zts-20170718/phalcon-v3.3.0.so -COPY ./php7-ext/mongodb-v1.3.4.so /usr/local/lib/php/extensions/no-debug-non-zts-20170718/mongodb-v1.3.4.so - -WORKDIR /usr/share/nginx/html -EXPOSE 9000 - -CMD ["php-fpm"] \ No newline at end of file diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 0a9211a..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 codemaxz - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md index e770477..3c88c0d 100644 --- a/README.md +++ b/README.md @@ -1 +1,43 @@ -# docker-php7phalcon \ No newline at end of file +Getting started for Docker Engine CE (Free Version) +--------------------------------------------------- + +``` +sudo mkdir -p build && cd build + +sudo apt-get install git -y + +sudo git clone https://github.com/drivesoft-technology/docker-awesome.git + +cd docker-awesome +``` + + +Install Docker Engine CE v18.06.1 (Free Version) +--------------------------------------------------- + +``` +bash docker-install/install-docker-engine-on-ubuntu18.sh +``` + + +Install Docker Compose v1.22.0 +--------------------------------------------------- + +``` +bash docker-install/install-docker-compose-on-ubuntu18.sh +``` + + +Start Service | Phalcon Application Template +--------------------------------------------------- + +``` +sudo git clone https://github.com/codestepz/docker-php7phalcon.git +sudo docker-compose -f docker-php7phalcon/docker-compose.yml up -d +``` + +``` +http://[IP ADDRESS] << Nginx v1.15.4-alpine + +http://[IP ADDRESS]/info.php << PHP v7.2.10 (FPM) +``` \ No newline at end of file diff --git a/build/mongodb/Dockerfile b/build/mongodb/Dockerfile deleted file mode 100644 index bf32686..0000000 --- a/build/mongodb/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM php:7.2.0-fpm -LABEL Eakkabin Jaikeawma - -RUN buildDeps='autoconf g++ gcc curl ca-certificates libc6-dev libpcre3-dev libssl-dev libcurl4-openssl-dev pkg-config make git' \ - && apt-get update && apt-get install -y $buildDeps --no-install-recommends \ - && docker-php-ext-install -j$(nproc) iconv mbstring \ - && mkdir -p /build && pecl install mongodb \ - && echo "extension=mongodb.so" > /usr/local/etc/php/conf.d/20-mongodb.ini \ - && rm -rf /build && apt-get clean && apt-get autoremove -y \ - && rm -r /var/lib/apt/lists/* && rm -rf /tmp/* /var/tmp/* \ - && apt-get purge -y --auto-remove $buildDeps - -EXPOSE 9000 - -CMD ["php-fpm"] \ No newline at end of file diff --git a/build/mongodb/README.md b/build/mongodb/README.md deleted file mode 100644 index 166a9d1..0000000 --- a/build/mongodb/README.md +++ /dev/null @@ -1,18 +0,0 @@ -Build MongoDB PHP Mobule. ---------------------------------------------------- - -``` -docker build -t build/php7mongo:7.2.0 . -``` - - -``` -docker run -it --name docker-php7mongo -d build/php7mongo:7.2.0 -docker cp docker-php7mongo:/usr/local/etc/php/conf.d/20-mongodb.ini ./../../php7-ini/20-mongodb.ini -docker cp docker-php7mongo:/usr/local/lib/php/extensions/no-debug-non-zts-20170718/mongodb.so ./../../php7-ext/mongodb.so -``` - - -``` -docker stop docker-php7mongo && docker rm docker-php7mongo -``` \ No newline at end of file diff --git a/build/phalcon3/Dockerfile b/build/phalcon3/Dockerfile deleted file mode 100644 index 9771126..0000000 --- a/build/phalcon3/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM php:7.2.0-fpm -LABEL Eakkabin Jaikeawma - -RUN buildDeps='autoconf g++ gcc ca-certificates libc6-dev libpcre3-dev libssl-dev libcurl4-openssl-dev pkg-config make re2c curl git' \ - && apt-get update && apt-get install -y --no-install-recommends \ - && apt-get install -y $buildDeps --no-install-recommends \ - && docker-php-ext-install -j$(nproc) iconv mbstring \ - && mkdir -p /build && cd /build \ - && git clone --depth=1 git://github.com/phalcon/cphalcon.git \ - && cd /build/cphalcon/build && ./install && echo "extension=phalcon.so" > /usr/local/etc/php/conf.d/20-phalcon.ini \ - && rm -rf /build \ - && apt-get clean && apt-get autoremove -y \ - && rm -r /var/lib/apt/lists/* && rm -rf /tmp/* /var/tmp/* \ - && apt-get purge -y --auto-remove $buildDeps - -EXPOSE 9000 - -CMD ["php-fpm"] diff --git a/build/phalcon3/README.md b/build/phalcon3/README.md deleted file mode 100644 index 0bcde2e..0000000 --- a/build/phalcon3/README.md +++ /dev/null @@ -1,18 +0,0 @@ -Build PHP Mobule with Phalcon Framework v3.3.x ---------------------------------------------------- - -``` -docker build -t build/php7phalcon:7.2.0 . -``` - - -``` -docker run -it --name docker-php7phalcon -d build/php7phalcon:7.2.0 -docker cp docker-php7phalcon:/usr/local/etc/php/conf.d/20-phalcon.ini ./../../php7-ini/20-phalcon.ini -docker cp docker-php7phalcon:/usr/local/lib/php/extensions/no-debug-non-zts-20170718/phalcon.so ./../../php7-ext/phalcon.so -``` - - -``` -docker stop docker-php7phalcon && docker rm docker-php7phalcon -``` \ No newline at end of file diff --git a/conf.d/default.conf b/conf.d/default.conf new file mode 100644 index 0000000..38715d8 --- /dev/null +++ b/conf.d/default.conf @@ -0,0 +1,52 @@ +server { + + listen 80; + server_name localhost; + + root /usr/share/nginx/html; + index index.php index.html index.htm; + + charset utf-8; + client_max_body_size 25m; + + add_header 'Access-Control-Allow-Origin' '*'; + + location / { + location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ { + proxy_cache off; + root /usr/share/nginx/html; + expires max; + try_files $uri @fallback; + } + } + + location = /favicon.ico { + access_log off; + log_not_found off; + } + + location ~ \.php$ { + try_files $uri =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass phpfpm:9000; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_intercept_errors off; + fastcgi_buffer_size 16k; + fastcgi_buffers 4 16k; + fastcgi_hide_header X-Powered-By; + proxy_hide_header X-Powered-By; + proxy_pass_header Server; + } + + location ~ /\.ht { + deny all; + return 404; + } + + error_page 401 403 404 /404.html; + error_log /var/log/nginx/localhost.error.log; + +} \ No newline at end of file diff --git a/conf.d/nginx.conf b/conf.d/nginx.conf new file mode 100644 index 0000000..1eded26 --- /dev/null +++ b/conf.d/nginx.conf @@ -0,0 +1,28 @@ + +user nginx; +worker_processes 1; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + keepalive_timeout 65; + + include /etc/nginx/conf.d/*.conf; + +} \ No newline at end of file diff --git a/conf.d/php7.ini b/conf.d/php7.ini new file mode 100644 index 0000000..6319239 --- /dev/null +++ b/conf.d/php7.ini @@ -0,0 +1,10 @@ +file_uploads = On + +post_max_size = 30M +upload_max_filesize = 30M + +memory_limit = 30M +max_execution_time = 600 + +# session.save_handler = redis +# session.save_path = "tcp://0.0.0.0:6379?auth=ee14586a07100033ec4a29abb4876735ccab39bf" \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4f4983c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,58 @@ +version: '3' + +services: + +# ====================================================================== +# Language +# ====================================================================== + + php7fpm1: + image: codestep/php7phalcon:7.2.10 + container_name: docker-php7fpm1 + working_dir: /usr/share/nginx/html + restart: always + environment: + - VIRTUAL_PORT=9000 + - TERM=xterm + volumes: + - ./www:/usr/share/nginx/html + - ./conf.d/php7.ini:/usr/local/etc/php/php.ini + ports: + - "9000:9000" + networks: + - frontend_network + +# ====================================================================== +# Web Server +# ====================================================================== + + main: + image: nginx:1.15.6-alpine + container_name: docker-main + working_dir: /usr/share/nginx/html + restart: always + environment: + - VIRTUAL_HOST=localhost + - VIRTUAL_PORT=80 + - NGINX_HOST=location + - NGINX_PORT=80 + - TERM=xterm + volumes: + - ./www:/usr/share/nginx/html + - ./conf.d/nginx.conf:/etc/nginx/nginx.conf + - ./conf.d/default.conf:/etc/nginx/conf.d/default.conf + links: + - "php7fpm1:phpfpm" + ports: + - "80:80" + networks: + - frontend_network + +networks: + frontend_network: + # name: frontend_network + # driver: bridge + ipam: + driver: default + config: + - subnet: 172.28.0.0/24 \ No newline at end of file diff --git a/php7-ext/mongodb-v1.3.4.so b/php7-ext/mongodb-v1.3.4.so deleted file mode 100644 index 105e600..0000000 Binary files a/php7-ext/mongodb-v1.3.4.so and /dev/null differ diff --git a/php7-ext/phalcon-v3.3.0.so b/php7-ext/phalcon-v3.3.0.so deleted file mode 100755 index 5063d34..0000000 Binary files a/php7-ext/phalcon-v3.3.0.so and /dev/null differ diff --git a/php7-ini/20-mongodb.ini b/php7-ini/20-mongodb.ini deleted file mode 100644 index d3bfd83..0000000 --- a/php7-ini/20-mongodb.ini +++ /dev/null @@ -1 +0,0 @@ -extension=mongodb-v1.3.4.so \ No newline at end of file diff --git a/php7-ini/20-phalcon.ini b/php7-ini/20-phalcon.ini deleted file mode 100644 index d611c53..0000000 --- a/php7-ini/20-phalcon.ini +++ /dev/null @@ -1 +0,0 @@ -extension=phalcon.so diff --git a/php7-ini/php7.ini b/php7-ini/php7.ini deleted file mode 100644 index 98cf95e..0000000 --- a/php7-ini/php7.ini +++ /dev/null @@ -1,7 +0,0 @@ -file_uploads = On - -post_max_size = 30M -upload_max_filesize = 30M - -memory_limit = 30M -max_execution_time = 600 \ No newline at end of file diff --git a/www/index.php b/www/index.php new file mode 100644 index 0000000..9b4758c --- /dev/null +++ b/www/index.php @@ -0,0 +1,32 @@ + + + + + + + Phalcon Framework 3.4.1 + + + + + + + +
+
+
+
+
+
+
+

Phalcon Framework

+

CodeStep โค้ดสเต็ป - เรียนรู้ออนไลน์ สะดวก ง่าย เข้าถึงได้ทุกที่

+
+
+
+
+
+
+
+ + \ No newline at end of file diff --git a/www/info.php b/www/info.php new file mode 100644 index 0000000..c9f5eeb --- /dev/null +++ b/www/info.php @@ -0,0 +1 @@ + \ No newline at end of file