Sign inSign up

ewsoftnc/http-opencart

By ewsoftnc

Updated over 8 years ago

Centos 7 + Apache 2.4 + php 7.2 + Opencart 3.0.2.0

Image
0

152

ewsoftnc/http-opencart repository overview

A) Dependencies

Depends on "centos/mysql-57-centos7" image. On the first run, if mounted volume is empty, mysql will initialise and create the database with the supplied parameters.

docker run -d \
--name mysql_database \
 -e MYSQL_USER=myuser \
 -e MYSQL_PASSWORD=mypass \
 -e MYSQL_DATABASE=opencart \
 --restart=unless-stopped \
 -v /path/to/host:/var/lib/mysql/data \
centos/mysql-57-centos7

B) Run container

docker run -d \
-v /path/to/host:/var/www \
-e VHOST="www.your_domain.com" \
-p 80:80 \
--link mysql_database \
--name http_opencart \
--restart=unless-stopped \
ewsoftnc/http-opencart:1.0

C) Installation

  • Enter to http://your_domain and proceed to Opencart installation.
  • Enter the admin panel at http://your_domain/admin and ignore the prompt asking you to move the storage directory (close the prompt from top right X).

D) Finalising installation and clean up

Login in the container http_opencart and run script "/oc_finish_install.sh" to finalise installation. Please note that the storage directory will be moved to /var/www.


IMPORTANT NOTES

  • DO NOT DELETE oc_installed_ok file!
  • DELETE install directory after finishing up installation.

Dockerfile

FROM centos:7
RUN yum -y update
RUN yum -y install httpd unzip rsync wget
RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm
RUN yum install -y yum-utils
RUN yum-config-manager --enable remi-php72
RUN yum install -y \
        php \
	php-mcrypt \
        php-cli \
        php-gd \
        php-curl \
        php-mysql \
        php-ldap \
        php-zip \
        php-fileinfo \
        php-mbstring

RUN yum clean all
RUN printf "\n\n ServerTokens Prod \n ServerSignature Off \n FileETag None \n TraceEnable off" >> /etc/httpd/conf/httpd.conf
RUN sed -i 's/Options Indexes FollowSymLinks/Options -Indexes -Includes -FollowSymLinks/' /etc/httpd/conf/httpd.conf
EXPOSE 80
COPY oc_finish_install.sh /
RUN chmod +x /oc_finish_install.sh
COPY httpd-php-entrypoint.sh /
RUN chmod +x /httpd-php-entrypoint.sh
CMD ["/httpd-php-entrypoint.sh"]

httpd-php-entrypoint.sh

#!/bin/bash
set -ex
printf "\nServerName $VHOST:80" >> /etc/httpd/conf/httpd.conf

if [ ! -f /var/www/html/oc_installed_ok ]; then

rm -rf /var/www/html/*
cd /tmp && \
	wget https://github.com/opencart/opencart/releases/download/3.0.2.0/3.0.2.0-OpenCart.zip && \
        unzip 3.0.2.0-OpenCart.zip -d /tmp/opencart_install && \
        rsync -av /tmp/opencart_install/upload/* /var/www/html/ && \
        mv /var/www/html/config-dist.php /var/www/html/config.php && \
        mv /var/www/html/admin/config-dist.php /var/www/html/admin/config.php && \
        touch /var/www/html/oc_installed_ok

chmod 0777 /var/www/html/system/storage/cache/ && \
chmod 0777 /var/www/html/system/storage/download/ && \
chmod 0777 /var/www/html/system/storage/logs/ && \
chmod 0777 /var/www/html/system/storage/modification/ && \
chmod 0777 /var/www/html/system/storage/session/ && \
chmod 0777 /var/www/html/system/storage/upload/ && \
chmod 0777 /var/www/html/system/storage/vendor/ && \
chmod 0777 /var/www/html/image/ && \
chmod 0777 /var/www/html/image/cache/ && \
chmod 0777 /var/www/html/image/catalog/ && \
chmod 0777 /var/www/html/config.php && \
chmod 0777 /var/www/html/admin/config.php

fi
exec httpd -DFOREGROUND

oc_finish_install.sh

#!/bin/bash
set -ex

mv /var/www/html/system/storage /var/www/ && \
        sed -i "s#define('DIR_STORAGE', DIR_SYSTEM . 'storage/');#define('DIR_STORAGE', '/var/www/storage/');#" /var/www/html/config.php && \
        sed -i "s#define('DIR_STORAGE', DIR_SYSTEM . 'storage/');#define('DIR_STORAGE', '/var/www/storage/');#" /var/www/html/admin/config.php && \
        chown -Rf apache:apache /var/www/html/* && \
        chown -Rf apache:apache /var/www/storage

echo "*** PLEASE DELETE /var/www/html/install directory ***";

Tag summary

Content type

Image

Digest

Size

264.5 MB

Last updated

over 8 years ago

docker pull ewsoftnc/http-opencart:1.0