From bfe45ebf3188a32d23168f0b1b7bc7d39df66e5c Mon Sep 17 00:00:00 2001
From: Kamil Manka <kamil.manka@seamless.se>
Date: Mon, 28 Dec 2015 11:46:37 +0100
Subject: [PATCH] Clean up the image

---
 Dockerfile          |  5 +----
 README.md           | 31 +++++++++++++++++++------------
 docker-compose.yaml | 13 -------------
 run.sh              | 11 ++++++++++-
 4 files changed, 30 insertions(+), 30 deletions(-)
 delete mode 100644 docker-compose.yaml

diff --git a/Dockerfile b/Dockerfile
index c3b94eb..02ff112 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,5 @@
 FROM ubuntu:14.04
-MAINTAINER Kamil Manka <kamil.manka@seamless.se>
+MAINTAINER Kamil Manka <kamil.manka@gmail.com>
 
 RUN DEBIAN_FRONTEND=noninteractive apt-get -y install unzip curl
 
@@ -7,9 +7,6 @@ ADD run.sh /run.sh
 RUN chmod +x /run.sh
 RUN mkdir -p /var/www/html
 
-# SEQR plugin directory
-RUN mkdir -p /var/www/html/modules/seqr
-
 # apache config
 ENV APACHE_RUN_USER www-data
 ENV APACHE_RUN_GROUP www-data
diff --git a/README.md b/README.md
index b075083..de45da9 100644
--- a/README.md
+++ b/README.md
@@ -1,25 +1,32 @@
-# seqr-prestashop-data
+# ecommerce-prestashop-data
 Docker data container for prestashop
 
 ## How to run this
-Mapping local plugin dev directory to the Prestashop data container.
 
 ```bash  
-export DEV_DIR /home/yourhome/path/to/seqr/plugin
 
-docker-compose up -d
+docker run -e PS_VERSION=1.6.1.3 ikamman/ecommerce-prestashop-data
 
 ```
 
-Your Prestashop site will be available on the **8080** port.
+### Mounting /var/www/html to the local machine
 
-## Available ports
- * 8080: Prestashop site
- * 3306: mysql database
- * 9000: Xdebug extension for PHP debugging
+```bash
 
-## Prestashop database
+docker run docker run -e PS_VERSION=1.6.1.3 -v /home/user/html:/var/www/html ikamman/ecommerce-prestashop-data
 
-  username: **root**
+```
+
+### Mounting only plugin directory to the local machine
+
+```bash
+
+docker run docker run -e PS_VERSION=1.6.1.3 -e PLUGIN_NAME=new_plugin -v /home/user/local_plugin:/var/www/html/new_plugin ikamman/ecommerce-prestashop-data
+
+```
+
+Please make sure that your **PLUGIN_NAME** match the destination directory name of the volume mounting
+
+## Directory permissions
 
-  password:
+The www-data is an owner/group of the /var/www/html container directory. If you're mounting this directory to the local file system make sure your www-data user/group exists in your system. The alternative is to grant access to ALL users on your local directory. This will allow the container process to write to it.  
diff --git a/docker-compose.yaml b/docker-compose.yaml
deleted file mode 100644
index 2b75dc5..0000000
--- a/docker-compose.yaml
+++ /dev/null
@@ -1,13 +0,0 @@
-web:
-  image: seqr-ecommerce-php-55
-  ports:
-    - "8080:80"
-    - "3306:3306"
-  volumes_from:
-    - data
-data:
-  image: seqr-prestashop-data
-  environment:
-    PS_VERSION: '1.6.1.3'
-  volumes:
-    - "${DEV_DIR}:/var/www/html/modules/seqr"
diff --git a/run.sh b/run.sh
index 3a231b3..520268f 100755
--- a/run.sh
+++ b/run.sh
@@ -1,9 +1,18 @@
 #!/bin/bash
+
+if [ -z "$PS_VERSION"]; then
+  echo "Prestashop version not found. Please set up PS_VERSION variable properly."
+  exit 1
+fi
+
 curl -s -o /tmp/temp "https://www.prestashop.com/download/old/prestashop_$PS_VERSION.zip"
 unzip -q /tmp/temp -d /tmp
 cp -rf /tmp/prestashop/* /var/www/html
 rm -rf /tmp/*
 chown -R www-data:www-data /var/www
-chmod -Rf 777 /var/www/html/modules/seqr
+
+if [ -n "$PLUGIN_NAME" ]; then
+  chmod -Rf 777 /var/www/html/modules/$PLUGIN_NAME
+fi
 
 exec /bin/true
-- 
GitLab