-
-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add installation types - developer and integrator
- Loading branch information
1 parent
1aefd81
commit 96a2aa4
Showing
24 changed files
with
422 additions
and
26 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
.bash_history | ||
node_modules |
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,54 @@ | ||
FROM alexcheng/apache2-php7:{{phpVersion}} | ||
|
||
Label maintainer="[email protected]" | ||
|
||
ENV MAGENTO_VERSION {{magento2Version}} | ||
ENV INSTALL_DIR /var/www/html | ||
ENV COMPOSER_HOME /var/www/.composer/ | ||
|
||
RUN curl -sS https://getcomposer.org/installer | php \ | ||
&& mv composer.phar /usr/local/bin/composer | ||
COPY ./auth.json $COMPOSER_HOME | ||
|
||
RUN requirements="libpng12-dev libmcrypt-dev libmcrypt4 libcurl3-dev libfreetype6 libjpeg-turbo8 libjpeg-turbo8-dev libpng12-dev libfreetype6-dev libicu-dev libxslt1-dev" \ | ||
&& apt-get update \ | ||
&& apt-get install -y $requirements \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& docker-php-ext-install pdo_mysql \ | ||
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ | ||
&& docker-php-ext-install gd \ | ||
&& docker-php-ext-install mcrypt \ | ||
&& docker-php-ext-install mbstring \ | ||
&& docker-php-ext-install zip \ | ||
&& docker-php-ext-install intl \ | ||
&& docker-php-ext-install xsl \ | ||
&& docker-php-ext-install soap \ | ||
&& requirementsToRemove="libpng12-dev libmcrypt-dev libcurl3-dev libpng12-dev libfreetype6-dev libjpeg-turbo8-dev" \ | ||
&& apt-get purge --auto-remove -y $requirementsToRemove | ||
|
||
RUN chsh -s /bin/bash www-data | ||
|
||
{{{magento2Installation}}} | ||
|
||
RUN cd $INSTALL_DIR \ | ||
&& find . -type d -exec chmod 770 {} \; \ | ||
&& find . -type f -exec chmod 660 {} \; \ | ||
&& chmod u+x bin/magento | ||
|
||
COPY ./install-magento /usr/local/bin/install-magento | ||
RUN chmod +x /usr/local/bin/install-magento | ||
|
||
COPY ./install-sampledata /usr/local/bin/install-sampledata | ||
RUN chmod +x /usr/local/bin/install-sampledata | ||
|
||
RUN a2enmod rewrite | ||
RUN echo "memory_limit=2048M" > /usr/local/etc/php/conf.d/memory-limit.ini | ||
|
||
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
WORKDIR $INSTALL_DIR | ||
|
||
# Add cron job | ||
ADD crontab /etc/cron.d/magento2-cron | ||
RUN chmod 0644 /etc/cron.d/magento2-cron \ | ||
&& crontab -u www-data /etc/cron.d/magento2-cron |
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
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,3 @@ | ||
* * * * * www-data /usr/local/bin/php /var/www/html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/html/var/log/magento.cron.log | ||
* * * * * www-data /usr/local/bin/php /var/www/html/bin/magento indexer:reindex | ||
{{{extraCronJobs}}} |
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 |
---|---|---|
@@ -1,21 +1,17 @@ | ||
FROM alexcheng/apache2-php7:7.1.11 | ||
|
||
MAINTAINER Fu Cheng <[email protected]> | ||
|
||
RUN a2enmod rewrite | ||
Label maintainer="[email protected]" | ||
|
||
ENV MAGENTO_VERSION 2.2.2 | ||
|
||
RUN rm -rf /var/www/html/* \ | ||
&& apt-get update \ | ||
&& apt-get install -y wget | ||
|
||
RUN cd /tmp && curl https://codeload.github.com/magento/magento2/tar.gz/$MAGENTO_VERSION -o $MAGENTO_VERSION.tar.gz && tar xvf $MAGENTO_VERSION.tar.gz && mv magento2-$MAGENTO_VERSION/* magento2-$MAGENTO_VERSION/.htaccess /var/www/html | ||
|
||
ENV INSTALL_DIR /var/www/html | ||
ENV COMPOSER_HOME /var/www/.composer/ | ||
|
||
RUN curl -sS https://getcomposer.org/installer | php \ | ||
&& mv composer.phar /usr/local/bin/composer | ||
COPY ./auth.json $COMPOSER_HOME | ||
|
||
RUN requirements="libpng12-dev libmcrypt-dev libmcrypt4 libcurl3-dev libfreetype6 libjpeg-turbo8 libjpeg-turbo8-dev libpng12-dev libfreetype6-dev libicu-dev libxslt1-dev" \ | ||
&& apt-get update \ | ||
&& apt-get install -y $requirements \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& docker-php-ext-install pdo_mysql \ | ||
|
@@ -30,33 +26,34 @@ RUN requirements="libpng12-dev libmcrypt-dev libmcrypt4 libcurl3-dev libfreetype | |
&& requirementsToRemove="libpng12-dev libmcrypt-dev libcurl3-dev libpng12-dev libfreetype6-dev libjpeg-turbo8-dev" \ | ||
&& apt-get purge --auto-remove -y $requirementsToRemove | ||
|
||
COPY ./auth.json /var/www/.composer/ | ||
RUN chsh -s /bin/bash www-data | ||
|
||
RUN cd /tmp && \ | ||
curl https://codeload.github.com/magento/magento2/tar.gz/$MAGENTO_VERSION -o $MAGENTO_VERSION.tar.gz && \ | ||
tar xvf $MAGENTO_VERSION.tar.gz && \ | ||
mv magento2-$MAGENTO_VERSION/* magento2-$MAGENTO_VERSION/.htaccess $INSTALL_DIR | ||
|
||
RUN chown -R www-data:www-data /var/www | ||
RUN su www-data -c "cd /var/www/html && composer install" | ||
RUN cd /var/www/html \ | ||
RUN su www-data -c "cd $INSTALL_DIR && composer install" | ||
RUN su www-data -c "cd $INSTALL_DIR && composer config repositories.magento composer https://repo.magento.com/" | ||
|
||
RUN cd $INSTALL_DIR \ | ||
&& find . -type d -exec chmod 770 {} \; \ | ||
&& find . -type f -exec chmod 660 {} \; \ | ||
&& chmod u+x bin/magento | ||
|
||
|
||
RUN su www-data -c "cd /var/www/html && composer config repositories.magento composer https://repo.magento.com/" | ||
|
||
|
||
COPY ./bin/install-magento /usr/local/bin/install-magento | ||
COPY ./install-magento /usr/local/bin/install-magento | ||
RUN chmod +x /usr/local/bin/install-magento | ||
|
||
COPY ./bin/install-sampledata /usr/local/bin/install-sampledata | ||
COPY ./install-sampledata /usr/local/bin/install-sampledata | ||
RUN chmod +x /usr/local/bin/install-sampledata | ||
|
||
RUN echo "memory_limit=1024M" > /usr/local/etc/php/conf.d/memory-limit.ini | ||
RUN a2enmod rewrite | ||
RUN echo "memory_limit=2048M" > /usr/local/etc/php/conf.d/memory-limit.ini | ||
|
||
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
#Commented out the next 3 lines, because i don't see no use of this | ||
WORKDIR /var/www/html | ||
#VOLUME /var/www/html/var | ||
#VOLUME /var/www/html/pub | ||
WORKDIR $INSTALL_DIR | ||
|
||
# Add cron job | ||
ADD crontab /etc/cron.d/magento2-cron | ||
|
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": "5310458a34d580de1700dfe826ff19a1", | ||
"password": "255059b03eb9d30604d5ef52fca7465d" | ||
} | ||
} | ||
} |
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,3 @@ | ||
* * * * * www-data /usr/local/bin/php /var/www/html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/html/var/log/magento.cron.log | ||
* * * * * www-data /usr/local/bin/php /var/www/html/bin/magento indexer:reindex | ||
|
File renamed without changes.
File renamed without changes.
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,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
su www-data <<EOSU | ||
/var/www/html/bin/magento setup:install --base-url=$MAGENTO_URL --backend-frontname=$MAGENTO_BACKEND_FRONTNAME --language=$MAGENTO_LANGUAGE --timezone=$MAGENTO_TIMEZONE --currency=$MAGENTO_DEFAULT_CURRENCY --db-host=$MYSQL_HOST --db-name=$MYSQL_DATABASE --db-user=$MYSQL_USER --db-password=$MYSQL_PASSWORD --use-secure=$MAGENTO_USE_SECURE --base-url-secure=$MAGENTO_BASE_URL_SECURE --use-secure-admin=$MAGENTO_USE_SECURE_ADMIN --admin-firstname=$MAGENTO_ADMIN_FIRSTNAME --admin-lastname=$MAGENTO_ADMIN_LASTNAME --admin-email=$MAGENTO_ADMIN_EMAIL --admin-user=$MAGENTO_ADMIN_USERNAME --admin-password=$MAGENTO_ADMIN_PASSWORD | ||
EOSU |
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,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
su www-data <<EOSU | ||
ln -s ~/.composer/auth.json /var/www/html/var/composer_home/ | ||
/var/www/html/bin/magento sampledata:deploy | ||
/var/www/html/bin/magento setup:upgrade | ||
/var/www/html/bin/magento setup:di:compile | ||
EOSU |
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,55 @@ | ||
FROM alexcheng/apache2-php7:7.1.11 | ||
|
||
Label maintainer="[email protected]" | ||
|
||
ENV MAGENTO_VERSION 2.2.2 | ||
ENV INSTALL_DIR /var/www/html | ||
ENV COMPOSER_HOME /var/www/.composer/ | ||
|
||
RUN curl -sS https://getcomposer.org/installer | php \ | ||
&& mv composer.phar /usr/local/bin/composer | ||
COPY ./auth.json $COMPOSER_HOME | ||
|
||
RUN requirements="libpng12-dev libmcrypt-dev libmcrypt4 libcurl3-dev libfreetype6 libjpeg-turbo8 libjpeg-turbo8-dev libpng12-dev libfreetype6-dev libicu-dev libxslt1-dev" \ | ||
&& apt-get update \ | ||
&& apt-get install -y $requirements \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& docker-php-ext-install pdo_mysql \ | ||
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ | ||
&& docker-php-ext-install gd \ | ||
&& docker-php-ext-install mcrypt \ | ||
&& docker-php-ext-install mbstring \ | ||
&& docker-php-ext-install zip \ | ||
&& docker-php-ext-install intl \ | ||
&& docker-php-ext-install xsl \ | ||
&& docker-php-ext-install soap \ | ||
&& requirementsToRemove="libpng12-dev libmcrypt-dev libcurl3-dev libpng12-dev libfreetype6-dev libjpeg-turbo8-dev" \ | ||
&& apt-get purge --auto-remove -y $requirementsToRemove | ||
|
||
RUN chsh -s /bin/bash www-data | ||
|
||
RUN chown -R www-data:www-data /var/www | ||
RUN su www-data -c "composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition $INSTALL_DIR $MAGENTO_VERSION" | ||
|
||
RUN cd $INSTALL_DIR \ | ||
&& find . -type d -exec chmod 770 {} \; \ | ||
&& find . -type f -exec chmod 660 {} \; \ | ||
&& chmod u+x bin/magento | ||
|
||
COPY ./install-magento /usr/local/bin/install-magento | ||
RUN chmod +x /usr/local/bin/install-magento | ||
|
||
COPY ./install-sampledata /usr/local/bin/install-sampledata | ||
RUN chmod +x /usr/local/bin/install-sampledata | ||
|
||
RUN a2enmod rewrite | ||
RUN echo "memory_limit=2048M" > /usr/local/etc/php/conf.d/memory-limit.ini | ||
|
||
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
WORKDIR $INSTALL_DIR | ||
|
||
# Add cron job | ||
ADD crontab /etc/cron.d/magento2-cron | ||
RUN chmod 0644 /etc/cron.d/magento2-cron \ | ||
&& crontab -u www-data /etc/cron.d/magento2-cron |
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": "5310458a34d580de1700dfe826ff19a1", | ||
"password": "255059b03eb9d30604d5ef52fca7465d" | ||
} | ||
} | ||
} |
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,4 @@ | ||
* * * * * www-data /usr/local/bin/php /var/www/html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /var/www/html/var/log/magento.cron.log | ||
* * * * * www-data /usr/local/bin/php /var/www/html/bin/magento indexer:reindex | ||
* * * * * www-data /usr/local/bin/php /var/www/html/update/cron.php >> /var/www/html/var/log/update.cron.log | ||
* * * * * www-data /usr/local/bin/php /var/www/html/bin/magento setup:cron:run >> /var/www/html/var/log/setup.cron.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
su www-data <<EOSU | ||
/var/www/html/bin/magento setup:install --base-url=$MAGENTO_URL --backend-frontname=$MAGENTO_BACKEND_FRONTNAME --language=$MAGENTO_LANGUAGE --timezone=$MAGENTO_TIMEZONE --currency=$MAGENTO_DEFAULT_CURRENCY --db-host=$MYSQL_HOST --db-name=$MYSQL_DATABASE --db-user=$MYSQL_USER --db-password=$MYSQL_PASSWORD --use-secure=$MAGENTO_USE_SECURE --base-url-secure=$MAGENTO_BASE_URL_SECURE --use-secure-admin=$MAGENTO_USE_SECURE_ADMIN --admin-firstname=$MAGENTO_ADMIN_FIRSTNAME --admin-lastname=$MAGENTO_ADMIN_LASTNAME --admin-email=$MAGENTO_ADMIN_EMAIL --admin-user=$MAGENTO_ADMIN_USERNAME --admin-password=$MAGENTO_ADMIN_PASSWORD | ||
EOSU |
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,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
su www-data <<EOSU | ||
ln -s ~/.composer/auth.json /var/www/html/var/composer_home/ | ||
/var/www/html/bin/magento sampledata:deploy | ||
/var/www/html/bin/magento setup:upgrade | ||
/var/www/html/bin/magento setup:di:compile | ||
EOSU |
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 @@ | ||
{ | ||
"name": "docker-magento2", | ||
"version": "1.0.0", | ||
"description": "Docker image for Magento 2", | ||
"main": "update.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/alexcheng1982/docker-magento2.git" | ||
}, | ||
"keywords": [], | ||
"author": "Fu Cheng <[email protected]>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/alexcheng1982/docker-magento2/issues" | ||
}, | ||
"homepage": "https://github.com/alexcheng1982/docker-magento2#readme", | ||
"dependencies": { | ||
"bluebird": "^3.5.1", | ||
"handlebars": "^4.0.11", | ||
"lodash.merge": "^4.6.1" | ||
} | ||
} |
Empty file.
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 @@ | ||
RUN cd /tmp && \ | ||
curl https://codeload.github.com/magento/magento2/tar.gz/$MAGENTO_VERSION -o $MAGENTO_VERSION.tar.gz && \ | ||
tar xvf $MAGENTO_VERSION.tar.gz && \ | ||
mv magento2-$MAGENTO_VERSION/* magento2-$MAGENTO_VERSION/.htaccess $INSTALL_DIR | ||
|
||
RUN chown -R www-data:www-data /var/www | ||
RUN su www-data -c "cd $INSTALL_DIR && composer install" | ||
RUN su www-data -c "cd $INSTALL_DIR && composer config repositories.magento composer https://repo.magento.com/" |
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,2 @@ | ||
* * * * * www-data /usr/local/bin/php /var/www/html/update/cron.php >> /var/www/html/var/log/update.cron.log | ||
* * * * * www-data /usr/local/bin/php /var/www/html/bin/magento setup:cron:run >> /var/www/html/var/log/setup.cron.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
RUN chown -R www-data:www-data /var/www | ||
RUN su www-data -c "composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition $INSTALL_DIR $MAGENTO_VERSION" |
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,42 @@ | ||
const Handlebars = require('handlebars'); | ||
const Promise = require('bluebird'); | ||
const merge = require('lodash.merge'); | ||
const fs = Promise.promisifyAll(require("fs")); | ||
const path = require("path"); | ||
|
||
const commonOptions = { | ||
phpVersion: '7.1.11', | ||
magento2Version: '2.2.2', | ||
}; | ||
|
||
function readPartial(profile, section) { | ||
return fs.readFileAsync(path.join(__dirname, 'partials', profile, section), 'utf8'); | ||
} | ||
|
||
function writeFile(context, profile, fileName, template) { | ||
return fs.readFileAsync(path.join(__dirname, template || `${fileName}.hbs`), 'utf8') | ||
.then(content => Handlebars.compile(content)(context)) | ||
.then(content => fs.writeFileAsync(path.join(__dirname, profile, fileName), content)); | ||
} | ||
|
||
function copyFile(fileName, profile) { | ||
return fs.copyFileAsync(path.join(__dirname, fileName), path.join(__dirname, profile, fileName)); | ||
} | ||
|
||
const profiles = ['integrator', 'developer']; | ||
const sections = ['magento2Installation', 'extraCronJobs']; | ||
const filesToCopy = ['auth.json', 'install-magento', 'install-sampledata']; | ||
const templatedFiles = ['Dockerfile', 'crontab']; | ||
Promise.map(profiles, profile => { | ||
return Promise.reduce(sections, (obj, section) => { | ||
return readPartial(profile, section).then(value => { | ||
obj[section] = value; | ||
return obj; | ||
}) | ||
}, {}).then(profileContext => { | ||
const context = merge({}, commonOptions, profileContext); | ||
return Promise.map(filesToCopy, fileToCopy => copyFile(fileToCopy, profile)) | ||
.then(_ => Promise.map(templatedFiles, templatedFile => writeFile(context, profile, templatedFile))); | ||
}); | ||
}).then(() => console.log("Update successfully")) | ||
.catch(console.error); |
Oops, something went wrong.