-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Serkan Yılmaz
committed
Apr 12, 2017
0 parents
commit 279ef6c
Showing
10 changed files
with
376 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
|
||
###How to run Magento 2 with Docker | ||
|
||
-- The following line define need in hosts file | ||
|
||
`127.0.0.1 magento2.local` | ||
|
||
|
||
-- Run in terminal the following lines at the magento main directory | ||
|
||
`docker-compose up` | ||
|
||
|
||
###Magento Admin User Credential | ||
|
||
**username** : admin | ||
|
||
**password** : magento12 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"http-basic": { | ||
"repo.magento.com": { | ||
"username": "3928a2448c6a84bcf2cdd15d8216ba2f", | ||
"password": "18a01a59720351061ffd1a5fe714c54c" | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
upstream fastcgi_backend { | ||
server phpfpm:9000; | ||
} | ||
|
||
server { | ||
listen 80; | ||
server_name localhost; | ||
set $MAGE_ROOT /var/www/magento2; | ||
root $MAGE_ROOT/pub; | ||
|
||
index index.php; | ||
autoindex off; | ||
charset UTF-8; | ||
error_page 404 403 = /errors/404.php; | ||
#add_header "X-UA-Compatible" "IE=Edge"; | ||
|
||
# PHP entry point for setup application | ||
location ~* ^/setup($|/) { | ||
root $MAGE_ROOT; | ||
location ~ ^/setup/index.php { | ||
fastcgi_pass fastcgi_backend; | ||
|
||
fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off"; | ||
fastcgi_param PHP_VALUE "memory_limit=768M \n max_execution_time=600"; | ||
fastcgi_read_timeout 600s; | ||
fastcgi_connect_timeout 600s; | ||
|
||
fastcgi_index index.php; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
include fastcgi_params; | ||
} | ||
|
||
location ~ ^/setup/(?!pub/). { | ||
deny all; | ||
} | ||
|
||
location ~ ^/setup/pub/ { | ||
add_header X-Frame-Options "SAMEORIGIN"; | ||
} | ||
} | ||
|
||
# PHP entry point for update application | ||
location ~* ^/update($|/) { | ||
root $MAGE_ROOT; | ||
|
||
location ~ ^/update/index.php { | ||
fastcgi_split_path_info ^(/update/index.php)(/.+)$; | ||
fastcgi_pass fastcgi_backend; | ||
fastcgi_index index.php; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
fastcgi_param PATH_INFO $fastcgi_path_info; | ||
include fastcgi_params; | ||
} | ||
|
||
# Deny everything but index.php | ||
location ~ ^/update/(?!pub/). { | ||
deny all; | ||
} | ||
|
||
location ~ ^/update/pub/ { | ||
add_header X-Frame-Options "SAMEORIGIN"; | ||
} | ||
} | ||
|
||
location / { | ||
try_files $uri $uri/ /index.php$is_args$args; | ||
} | ||
|
||
location /pub/ { | ||
location ~ ^/pub/media/(downloadable|customer|import|theme_customization/.*\.xml) { | ||
deny all; | ||
} | ||
alias $MAGE_ROOT/pub/; | ||
add_header X-Frame-Options "SAMEORIGIN"; | ||
} | ||
|
||
location /static/ { | ||
# Uncomment the following line in production mode | ||
# expires max; | ||
|
||
# Remove signature of the static files that is used to overcome the browser cache | ||
location ~ ^/static/version { | ||
rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last; | ||
} | ||
|
||
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ { | ||
add_header Cache-Control "public"; | ||
add_header X-Frame-Options "SAMEORIGIN"; | ||
expires +1y; | ||
|
||
if (!-f $request_filename) { | ||
rewrite ^/static/?(.*)$ /static.php?resource=$1 last; | ||
} | ||
} | ||
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ { | ||
add_header Cache-Control "no-store"; | ||
add_header X-Frame-Options "SAMEORIGIN"; | ||
expires off; | ||
|
||
if (!-f $request_filename) { | ||
rewrite ^/static/?(.*)$ /static.php?resource=$1 last; | ||
} | ||
} | ||
if (!-f $request_filename) { | ||
rewrite ^/static/?(.*)$ /static.php?resource=$1 last; | ||
} | ||
add_header X-Frame-Options "SAMEORIGIN"; | ||
} | ||
|
||
location /media/ { | ||
try_files $uri $uri/ /get.php$is_args$args; | ||
|
||
location ~ ^/media/theme_customization/.*\.xml { | ||
deny all; | ||
} | ||
|
||
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ { | ||
add_header Cache-Control "public"; | ||
add_header X-Frame-Options "SAMEORIGIN"; | ||
expires +1y; | ||
try_files $uri $uri/ /get.php$is_args$args; | ||
} | ||
location ~* \.(zip|gz|gzip|bz2|csv|xml)$ { | ||
add_header Cache-Control "no-store"; | ||
add_header X-Frame-Options "SAMEORIGIN"; | ||
expires off; | ||
try_files $uri $uri/ /get.php$is_args$args; | ||
} | ||
add_header X-Frame-Options "SAMEORIGIN"; | ||
} | ||
|
||
location /media/customer/ { | ||
deny all; | ||
} | ||
|
||
location /media/downloadable/ { | ||
deny all; | ||
} | ||
|
||
location /media/import/ { | ||
deny all; | ||
} | ||
|
||
# PHP entry point for main application | ||
location ~ (index|get|static|report|404|503)\.php$ { | ||
try_files $uri =404; | ||
fastcgi_pass fastcgi_backend; | ||
fastcgi_buffers 1024 4k; | ||
|
||
fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off"; | ||
fastcgi_param PHP_VALUE "memory_limit=768M \n max_execution_time=18000"; | ||
fastcgi_read_timeout 600s; | ||
fastcgi_connect_timeout 600s; | ||
|
||
fastcgi_index index.php; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
include fastcgi_params; | ||
} | ||
|
||
gzip on; | ||
gzip_disable "msie6"; | ||
|
||
gzip_comp_level 6; | ||
gzip_min_length 1100; | ||
gzip_buffers 16 8k; | ||
gzip_proxied any; | ||
gzip_types | ||
text/plain | ||
text/css | ||
text/js | ||
text/xml | ||
text/javascript | ||
application/javascript | ||
application/x-javascript | ||
application/json | ||
application/xml | ||
application/xml+rss | ||
image/svg+xml; | ||
gzip_vary on; | ||
|
||
# Banned locations (only reached if the earlier PHP entry point regexes don't match) | ||
location ~* (\.php$|\.htaccess$|\.git) { | ||
deny all; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
; Copyright © 2013-2017 Magento, Inc. All rights reserved. | ||
; See COPYING.txt for license details. | ||
; This file is for CGI/FastCGI installations. | ||
; Try copying it to php5.ini, if it doesn't work | ||
|
||
; adjust memory limit | ||
|
||
memory_limit = -1 | ||
|
||
max_execution_time = 18000 | ||
|
||
; disable automatic session start | ||
; before autoload was initialized | ||
|
||
flag session.auto_start = off | ||
|
||
; enable resulting html compression | ||
|
||
zlib.output_compression = on | ||
|
||
; disable user agent verification to not break multiple image upload | ||
|
||
suhosin.session.cryptua = off | ||
|
||
; PHP for some reason ignores this setting in system php.ini | ||
; and disables mcrypt if this line is missing in local php.ini | ||
|
||
extension=mcrypt.so | ||
|
||
; Disable PHP errors, notices and warnings output in production mode to prevent exposing sensitive information. | ||
|
||
pm.max_requests = 500 | ||
|
||
display_errors = On | ||
|
||
always_populate_raw_post_data = -1 | ||
|
||
log_errors = On | ||
|
||
error_log = /dev/stderr |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
version: '2' | ||
|
||
services: | ||
phpfpm: | ||
build: | ||
context: ./docker/phpfpm/ | ||
volumes: | ||
- /var/www/magento2 | ||
- docroot:/var/www/magento2 | ||
- ./composer/auth.json:/root/.composer/auth.json | ||
- ./confs/php.ini:/usr/local/etc/php/php.ini | ||
ports: | ||
- "9000:9000" | ||
hostname: phpfpm | ||
environment: | ||
- MAGENTO_BASE_URL=http://magento2.local | ||
links: | ||
- mysql | ||
nginx: | ||
build: | ||
context: ./docker/nginx/ | ||
volumes: | ||
- /var/www/magento2 | ||
- docroot:/var/www/magento2 | ||
- ./confs/magento2.conf:/etc/nginx/conf.d/magento2.conf | ||
ports: | ||
- "80:80" | ||
environment: | ||
- NGINX_HOST=http://magento2.local | ||
- NGINX_PORT=80 | ||
links: | ||
- phpfpm | ||
mysql: | ||
image: mysql:latest | ||
ports: | ||
- "3306:3306" | ||
hostname: mysql | ||
volumes: | ||
- ./docker/mysql/:/tmp/database | ||
- my-datavolume:/var/lib/mysql | ||
command: mysqld --init-file="/tmp/database/schema.sql" | ||
environment: | ||
- MYSQL_ROOT_PASSWORD=root | ||
volumes: | ||
my-datavolume: | ||
docroot: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CREATE DATABASE IF NOT EXISTS magento; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM nginx:latest | ||
|
||
MAINTAINER Serkan Yılmaz <[email protected]> | ||
|
||
RUN /bin/bash -c "cd /etc/nginx/conf.d && mv ./default.conf ./default.disabled" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM php:7.0.16-fpm | ||
|
||
MAINTAINER Serkan Yılmaz <[email protected]> | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y \ | ||
libicu-dev \ | ||
libfreetype6-dev \ | ||
libjpeg62-turbo-dev \ | ||
libmcrypt-dev \ | ||
libpng12-dev \ | ||
libxslt-dev \ | ||
&& docker-php-ext-install -j$(nproc) mcrypt intl xsl zip pdo_mysql \ | ||
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ | ||
&& docker-php-ext-install -j$(nproc) gd | ||
|
||
RUN curl -sS https://getcomposer.org/installer | php | ||
RUN mv composer.phar /usr/local/bin/composer | ||
|
||
COPY ./entrypoint.sh / | ||
RUN chmod +x /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/sh | ||
echo "Initializing setup..." | ||
|
||
cd /var/www/magento2 | ||
|
||
if [ -f ./app/etc/config.php ] || [ -f ./app/etc/env.php ]; then | ||
php bin/magento setup:store-config:set --base-url=${MAGENTO_BASE_URL} | ||
echo "Magento2 is already installed!" | ||
else | ||
|
||
count="$( find . -mindepth 1 -maxdepth 1 | wc -l )" | ||
|
||
if [ $count -ne 0 ] ; then | ||
yes | rm -rf ./* | ||
find . -maxdepth 1 -name \* -type f -delete | ||
fi | ||
|
||
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition . | ||
|
||
find . -type f -exec chmod 644 {} \; | ||
find . -type d -exec chmod 755 {} \; | ||
find ./var -type d -exec chmod 777 {} \; | ||
find ./pub/media -type d -exec chmod 777 {} \; | ||
find ./pub/static -type d -exec chmod 777 {} \; | ||
|
||
php bin/magento setup:install \ | ||
--base-url=${MAGENTO_BASE_URL} \ | ||
--db-host="mysql" \ | ||
--db-name="magento" \ | ||
--db-user="root" \ | ||
--db-password="root" \ | ||
--admin-firstname="admin" \ | ||
--admin-lastname="admin" \ | ||
--admin-email="[email protected]" \ | ||
--admin-user="admin" \ | ||
--admin-password="magento12" \ | ||
--language="en_US" \ | ||
--currency="USD" \ | ||
--timezone="America/Chicago" \ | ||
--use-rewrites="1" \ | ||
--backend-frontname="admin" | ||
|
||
chown -R www-data:www-data . | ||
echo "Magento install process done !" | ||
fi | ||
|
||
pkill php-fpm | ||
php-fpm |