From c9b0398df004ba59ef5db5da34767790c9b032c8 Mon Sep 17 00:00:00 2001 From: Felix Breidenstein Date: Tue, 20 Feb 2018 10:58:07 +0100 Subject: [PATCH 1/7] Dockerfile: User && instead of ; We don't want to continue if any of the commands fails. && only executes the next command on exitocde 0. --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index b0121340..535d826e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,10 +6,10 @@ RUN apt-get update && apt-get install -y \ libpng12-dev \ wget \ zip \ - unzip; \ + unzip && \ # We install and enable php-gd - docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \ - docker-php-ext-install -j$(nproc) gd; \ + docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ &&\ + docker-php-ext-install -j$(nproc) gd && \ # We enable Apache's mod_rewrite a2enmod rewrite From 460d7ec3eba1fd4314176da185cf47b551d91e98 Mon Sep 17 00:00:00 2001 From: Felix Breidenstein Date: Tue, 20 Feb 2018 10:59:04 +0100 Subject: [PATCH 2/7] Dockerfile: Be more specific about the path Without looking at the php:apache image, it is unclear what the destination of the COPY command is --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 535d826e..4886a9e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,4 +14,4 @@ RUN apt-get update && apt-get install -y \ # We enable Apache's mod_rewrite a2enmod rewrite -COPY . . +COPY . /var/www/html From 82dc08e7e7e6ae3fc91fc9d2b0c8c0166b6eefa3 Mon Sep 17 00:00:00 2001 From: Felix Breidenstein Date: Tue, 20 Feb 2018 11:08:30 +0100 Subject: [PATCH 3/7] Dockerfile: Use correct libpng package for Debian Stretch --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4886a9e5..3302bebd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM php:apache RUN apt-get update && apt-get install -y \ libfreetype6-dev \ libjpeg62-turbo-dev \ - libpng12-dev \ + libpng-dev \ wget \ zip \ unzip && \ From 43d48ae2df9ed4ed56b3861f442d73481d1fc713 Mon Sep 17 00:00:00 2001 From: Felix Breidenstein Date: Tue, 20 Feb 2018 11:11:12 +0100 Subject: [PATCH 4/7] Dockerfile: Remove empty line in RUN command This will throw errors in future Docker versions --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3302bebd..6e7e1686 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,6 @@ RUN apt-get update && apt-get install -y \ # We install and enable php-gd docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ &&\ docker-php-ext-install -j$(nproc) gd && \ - # We enable Apache's mod_rewrite a2enmod rewrite From 8c19e869b75fce4d905c76d4d588fbf3cd64623b Mon Sep 17 00:00:00 2001 From: Felix Breidenstein Date: Tue, 20 Feb 2018 12:12:32 +0100 Subject: [PATCH 5/7] Dockerfile: Define data volume and entryscript The entryscript is needed to set correct permissions on the data directory. --- Dockerfile | 8 ++++++++ docker/entrypoint.sh | 5 +++++ 2 files changed, 13 insertions(+) create mode 100755 docker/entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 6e7e1686..c7d45baf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,4 +13,12 @@ RUN apt-get update && apt-get install -y \ # We enable Apache's mod_rewrite a2enmod rewrite + +# Copy app content COPY . /var/www/html + +# Copy start script +COPY docker/entrypoint.sh / +VOLUME /var/www/html/data + +CMD /entrypoint.sh diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 00000000..6d2df637 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,5 @@ +#! /bin/sh + +chown -R www-data /var/www/html/data +rm -r /var/www/html/docker +apache2-foreground From d3c3cb0c1f6bdf73078f58e2f2a2c6cc4ddf8bd7 Mon Sep 17 00:00:00 2001 From: Felix Breidenstein Date: Tue, 20 Feb 2018 12:23:52 +0100 Subject: [PATCH 6/7] Dockerfile: Better handling of entrypoint.sh --- Dockerfile | 4 +++- docker/entrypoint.sh | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index c7d45baf..7bc9e127 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,9 @@ RUN apt-get update && apt-get install -y \ COPY . /var/www/html # Copy start script -COPY docker/entrypoint.sh / +RUN mv /var/www/html/docker/entrypoint.sh / && \ + rm -r /var/www/html/docker + VOLUME /var/www/html/data CMD /entrypoint.sh diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 6d2df637..124f2ea4 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -1,5 +1,4 @@ #! /bin/sh chown -R www-data /var/www/html/data -rm -r /var/www/html/docker apache2-foreground From 5602e47c5f8cbb6bdf96ad428373666e49f40f49 Mon Sep 17 00:00:00 2001 From: Felix Breidenstein Date: Tue, 20 Feb 2018 12:32:02 +0100 Subject: [PATCH 7/7] Added docker-compose.yml --- docker-compose.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..31432216 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +version: '3' + +services: + privatebin: + build: . + ports: + - "3000:80" + volumes: + - data:/var/www/html/data + # Optionally mount a custom config file + #- /srv/docker/privatebin/conf.php:/var/www/html/cfg/conf.php + +volumes: + data: +