Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .deploypr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
deploy_on:
- comment
build:
commands:
- "make"
image: "testrigor/build-env"
compose: docker-compose.yml
setup:
- "make reset"
postfix: ""

39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# From Ubuntu 16.04 image
FROM ubuntu:16.04

#Setting up Environment variables
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
ENV APACHE_LOCK_DIR /var/lock/apache2
ENV APACHE_PID_FILE /var/run/apache2.pid

#Install apache, php7, zip, curl
RUN set -xe \
&& apt-get update \
&& apt-get install -y apache2 zip curl \
&& apt-get install -y php7.0 php7.0-* libapache2-mod-php7.0

#Set working directory to /var/www/html
WORKDIR /var/www/html

#Clean up and chown of html directory
RUN set -xe \
&& apt-get install -y snmp \
&& apt-get clean \
&& rm /var/www/html/index.html \
&& chown -R www-data:www-data /var/www/html

# Enable apache mods.
RUN a2enmod php7.0
RUN a2enmod rewrite

# Update the PHP.ini file, enable <? ?> tags and quieten logging.
RUN sed -i "s/short_open_tag = Off/short_open_tag = On/" /etc/php/7.0/apache2/php.ini
RUN sed -i "s/error_reporting = .*$/error_reporting = E_ERROR | E_WARNING | E_PARSE/" /etc/php/7.0/apache2/php.ini

#Expose port 80
EXPOSE 80

# Run apache on docker run
CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]
19 changes: 19 additions & 0 deletions Dockerfile.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM ubuntu:16.04

RUN ["/bin/bash", "-c", "apt-get update && \
apt-get install -y -f apt-transport-https apt-utils lsb-core software-properties-common && \
apt-get install -y -f curl && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \
add-apt-repository \"deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable\" && \
apt-get update && \
apt-get install -y docker-ce && \
curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose && \
chmod +x /usr/local/bin/docker-compose && \
apt-get install -y -f mysql-client && \
apt-get install -y -f zip git make && \
apt-get install -y -f apache2 && \
apt-get install -y -f php7.0-intl php-fdomdocument php7.0-curl php7.0-zip php7.0-xml php7.0-mbstring && \
apt-get install -y -f composer"]

WORKDIR /project

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeyanthimuthuram this is what I had in mind and this is how Sunil's code work

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can't mount the volume while docker file is building


20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.PHONY: *

all: init

build-base:
docker build -t build-env -f Dockerfile.build .

init:
mv /project/upload/config-dist.php /project/upload/config.php
mv /project/upload/admin/config-dist.php /project/upload/admin/config.php
chown -R www-data:www-data /project

reset:
docker exec -it opencart php /var/www/html/install/cli_install.php install --db_hostname mariadb --db_username root --db_password mariaSql --db_database opencart --db_driver mysqli --db_port 3306 --username admin --password opencartpass --email admin@myopencart.com --http_server http://13.57.225.143/

up:
docker-compose up -d

down:
docker-compose down
30 changes: 30 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: "3"

services:
mysql:
container_name: mariadb
image: mariadb
ports:
- "3306"
environment:
MYSQL_ROOT_PASSWORD: mariaSql
MYSQL_DATABASE: opencart
restart: always

web:
container_name: opencart
build:
context: .
dockerfile: Dockerfile
environment:
DB_PASSWD: mariaSql
DB_NAME: opencart
DB_SERVER: mysql
ports:
- "80:80"
links:
- mysql:database
volumes:
- ./upload:/var/www/html/
restart: always