From 11768d361f54696578b936aba6e23a1397c1083e Mon Sep 17 00:00:00 2001 From: Mike Date: Thu, 21 Jan 2016 16:06:28 +0100 Subject: [PATCH 1/4] adding Docker and docker-compose.yml --- Dockerfile | 30 ++++++++++++++++++++++++++++++ docker-compose.yml | 17 +++++++++++++++++ docker-entrypoint.sh | 17 +++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 docker-entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fcc1ba6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +FROM php:5.6-apache + +RUN apt-get update && apt-get install -y \ + zip \ + libjpeg-dev \ + libpng12-dev \ + && rm -rf /var/lib/apt/lists/* + +RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 0xb5dbd5925590a237 + +RUN docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \ + && docker-php-ext-install gd mbstring mysqli zip exif json + +# RUN pecl install APCu + +ENV LYCHEE_VERSION v3.0.9 + +VOLUME /var/www/html/ + +RUN curl -fsSL -o lychee.tar.gz \ + "https://github.com/electerious/Lychee/archive/${LYCHEE_VERSION}.tar.gz" \ + && tar -xzf lychee.tar.gz -C /usr/src/ \ + && rm lychee.tar.gz + +# COPY php.ini /usr/local/etc/php/php.ini + +COPY docker-entrypoint.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["apache2-foreground"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..67ba58f --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +db: + image: mysql + volumes: + - /volume/mysql/:/var/lib/mysql + environment: + - MYSQL_ROOT_PASSWORD=rootpassword + - MYSQL_USER=mysqluser + - MYSQL_PASSWORD=password + - MYSQL_DATABASE=lychee +web: + image: mikemichel/lychee + links: + - db + volumes: + - /volume/web:/var/www/html/ + ports: + - 80:80 diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..6fadecb --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,17 @@ +#!/bin/bash +set -e + +if [ ! -e '/var/www/html/view.php' ]; then + echo >&2 "Piwik not found in $(pwd) - copying now..." + if [ "$(ls -A)" ]; then + echo >&2 "WARNING: $(pwd) is not empty - press Ctrl+C now if this is an error!" + ( set -x; ls -A; sleep 10 ) + fi + tar cf - --one-file-system -C /usr/src/Lychee* . | tar xf - + chown -R www-data /var/www/html + echo >&2 "Complete! Piwik has been successfully copied to $(pwd)" +fi + +chfn -f 'Piwik Admin' www-data + +exec "$@" From 2cb24b94632c8853bb91cc24c4f185036e2211fb Mon Sep 17 00:00:00 2001 From: Mike Date: Thu, 21 Jan 2016 16:18:27 +0100 Subject: [PATCH 2/4] minor changes --- Dockerfile | 3 --- docker-compose.yml | 4 +++- docker-entrypoint.sh | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index fcc1ba6..2200054 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,8 +11,6 @@ RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 0xb5dbd5925590a237 RUN docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \ && docker-php-ext-install gd mbstring mysqli zip exif json -# RUN pecl install APCu - ENV LYCHEE_VERSION v3.0.9 VOLUME /var/www/html/ @@ -24,7 +22,6 @@ RUN curl -fsSL -o lychee.tar.gz \ # COPY php.ini /usr/local/etc/php/php.ini -COPY docker-entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] CMD ["apache2-foreground"] diff --git a/docker-compose.yml b/docker-compose.yml index 67ba58f..6939985 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,6 +12,8 @@ web: links: - db volumes: - - /volume/web:/var/www/html/ + - /volume/web:/var/www/html/uploads + - /volume/data:/var/www/html/data + ports: - 80:80 diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 6fadecb..3386f55 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -2,16 +2,16 @@ set -e if [ ! -e '/var/www/html/view.php' ]; then - echo >&2 "Piwik not found in $(pwd) - copying now..." + echo >&2 "Lychee not found in $(pwd) - copying now..." if [ "$(ls -A)" ]; then echo >&2 "WARNING: $(pwd) is not empty - press Ctrl+C now if this is an error!" ( set -x; ls -A; sleep 10 ) fi tar cf - --one-file-system -C /usr/src/Lychee* . | tar xf - chown -R www-data /var/www/html - echo >&2 "Complete! Piwik has been successfully copied to $(pwd)" + echo >&2 "Complete! Lychee has been successfully copied to $(pwd)" fi -chfn -f 'Piwik Admin' www-data +chfn -f 'Lychee Admin' www-data exec "$@" From 6d423b54dab44f6d35ccba8f551e3820ed43c59a Mon Sep 17 00:00:00 2001 From: Mike Date: Thu, 21 Jan 2016 16:18:49 +0100 Subject: [PATCH 3/4] make it official --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6939985..abab0ed 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ db: - MYSQL_PASSWORD=password - MYSQL_DATABASE=lychee web: - image: mikemichel/lychee + image: lychee links: - db volumes: From c0002760e9c169900a71ab414f2fd71f5101a58f Mon Sep 17 00:00:00 2001 From: Mike Date: Thu, 21 Jan 2016 18:39:35 +0100 Subject: [PATCH 4/4] removing extra space --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2200054..ea13b4b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,5 @@ RUN curl -fsSL -o lychee.tar.gz \ # COPY php.ini /usr/local/etc/php/php.ini - ENTRYPOINT ["/entrypoint.sh"] CMD ["apache2-foreground"]