From 172945b3c97e50ee26e15dce780f815e1a7bf9d5 Mon Sep 17 00:00:00 2001 From: Julien Cabillot Date: Thu, 19 Oct 2017 12:55:44 +0200 Subject: [PATCH 01/12] import --- Dockerfile | 3 +++ src/index.php | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 Dockerfile create mode 100644 src/index.php diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a317d68 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM php:apache + +COPY src/ /var/www/html/ diff --git a/src/index.php b/src/index.php new file mode 100644 index 0000000..7687e2c --- /dev/null +++ b/src/index.php @@ -0,0 +1,3 @@ + Date: Tue, 24 Oct 2017 09:02:50 +0200 Subject: [PATCH 02/12] on remonte src d'un cran --- Dockerfile | 2 +- src/index.php => index.php | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/index.php => index.php (100%) diff --git a/Dockerfile b/Dockerfile index a317d68..0a7f157 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,3 @@ FROM php:apache -COPY src/ /var/www/html/ +COPY . /var/www/html diff --git a/src/index.php b/index.php similarity index 100% rename from src/index.php rename to index.php From f0d40b680bf70a31b01d96b858760e2bd2785e23 Mon Sep 17 00:00:00 2001 From: Julien Cabillot Date: Tue, 31 Oct 2017 13:08:31 +0000 Subject: [PATCH 03/12] HEALTHCHECK --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index 0a7f157..5f85e24 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,6 @@ FROM php:apache COPY . /var/www/html + +HEALTHCHECK --interval=10s \ + CMD curl --fail "http://localhost" || exit 1 \ No newline at end of file From 9b852f73dfd912394797506ebfcd39d47fe91d1a Mon Sep 17 00:00:00 2001 From: Julien Cabillot Date: Wed, 1 Nov 2017 12:13:15 +0000 Subject: [PATCH 04/12] Add .gitlab-ci.yml --- .gitlab-ci.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..2c562ae --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,23 @@ +image: docker:latest + +services: + - docker:dind + +before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + +build-master: + stage: build + script: + - docker build --pull -t "$CI_REGISTRY_IMAGE" . + - docker push "$CI_REGISTRY_IMAGE" + only: + - master + +build: + stage: build + script: + - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" . + - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" + except: + - master From 7c28d4aea9d0767fda5e508526e2d812a091ea3f Mon Sep 17 00:00:00 2001 From: Julien Cabillot Date: Wed, 1 Nov 2017 17:17:12 +0100 Subject: [PATCH 05/12] on tourne sans root, menage de /var/www/html --- Dockerfile | 16 ++++++++++++---- index.php => root/index.php | 0 2 files changed, 12 insertions(+), 4 deletions(-) rename index.php => root/index.php (100%) diff --git a/Dockerfile b/Dockerfile index 5f85e24..3693bab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,14 @@ -FROM php:apache +FROM "php:apache" -COPY . /var/www/html +RUN rm -rf "/var/www/html" && \ + sed -i'' 's/^Listen 80$/Listen 8080/' "/etc/apache2/ports.conf" && \ + sed -i'' 's/^$//' '/etc/apache2/sites-enabled/000-default.conf' -HEALTHCHECK --interval=10s \ - CMD curl --fail "http://localhost" || exit 1 \ No newline at end of file +COPY "root" "/var/www/html" + +RUN chown -R "www-data":"www-data" "/var/www/html" + +USER "www-data" + +HEALTHCHECK --interval="10s" \ + CMD curl --fail "http://localhost:8080" || exit 1 diff --git a/index.php b/root/index.php similarity index 100% rename from index.php rename to root/index.php From 0a771579e8d067e9a0a409a9184e18678aecf9e5 Mon Sep 17 00:00:00 2001 From: Julien Cabillot Date: Wed, 1 Nov 2017 18:31:21 +0100 Subject: [PATCH 06/12] =?UTF-8?q?on=20affiche=20la=20vraie=20ip=20grace=20?= =?UTF-8?q?=C3=A0=20mod=5Fremoteip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3693bab..7c3158e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,15 @@ -FROM "php:apache" +FROM "php:7.1-apache" RUN rm -rf "/var/www/html" && \ sed -i'' 's/^Listen 80$/Listen 8080/' "/etc/apache2/ports.conf" && \ - sed -i'' 's/^$//' '/etc/apache2/sites-enabled/000-default.conf' + sed -i'' 's/^$//' '/etc/apache2/sites-enabled/000-default.conf' && \ + { \ + echo 'RemoteIPHeader X-Real-IP'; \ + echo 'RemoteIPProxiesHeader X-Forwarded-By'; \ + } | tee "$APACHE_CONFDIR/conf-available/remoteip.conf" && \ + a2enconf remoteip && \ + a2enmod remoteip + COPY "root" "/var/www/html" From 94abe32382e98fabfadd4abe9d69edaf87cf635e Mon Sep 17 00:00:00 2001 From: Julien Cabillot Date: Fri, 3 Nov 2017 08:44:18 +0100 Subject: [PATCH 07/12] =?UTF-8?q?m=C3=A9nage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7c3158e..f15d4e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,8 +8,16 @@ RUN rm -rf "/var/www/html" && \ echo 'RemoteIPProxiesHeader X-Forwarded-By'; \ } | tee "$APACHE_CONFDIR/conf-available/remoteip.conf" && \ a2enconf remoteip && \ - a2enmod remoteip - + a2enmod remoteip && \ + apt-get -y autoremove --purge && \ + apt-get -y clean all && \ + rm -rf "/usr/share/doc/*" \ + "/var/cache/*" \ + "/var/lib/apt/lists/*" \ + "/usr/src/*" \ + "/var/cache/*" \ + "/var/log/"{apt/*,dpkg.log} \ + "/var/www/html" COPY "root" "/var/www/html" From c4601ea84125e28f07046952eb60bedc791fa81f Mon Sep 17 00:00:00 2001 From: Julien Cabillot Date: Fri, 3 Nov 2017 08:50:33 +0100 Subject: [PATCH 08/12] =?UTF-8?q?m=C3=A9nage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f15d4e9..4d8af92 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,8 @@ RUN rm -rf "/var/www/html" && \ "/usr/src/*" \ "/var/cache/*" \ "/var/log/"{apt/*,dpkg.log} \ - "/var/www/html" + "/var/www/html" \ + "/tmp/*" COPY "root" "/var/www/html" From 7cf5ccae3738148616a1d9858ac2bcfa58337d91 Mon Sep 17 00:00:00 2001 From: Julien Cabillot Date: Mon, 6 Nov 2017 11:06:56 +0100 Subject: [PATCH 09/12] ajout de tiny pour l'init --- Dockerfile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4d8af92..0700307 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ FROM "php:7.1-apache" -RUN rm -rf "/var/www/html" && \ - sed -i'' 's/^Listen 80$/Listen 8080/' "/etc/apache2/ports.conf" && \ +RUN sed -i'' 's/^Listen 80$/Listen 8080/' "/etc/apache2/ports.conf" && \ sed -i'' 's/^$//' '/etc/apache2/sites-enabled/000-default.conf' && \ { \ echo 'RemoteIPHeader X-Real-IP'; \ @@ -24,7 +23,15 @@ COPY "root" "/var/www/html" RUN chown -R "www-data":"www-data" "/var/www/html" +# Add Tini +ENV "TINI_VERSION" "v0.16.1" +ADD "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini" "/tini" +RUN chmod +x "/tini" +ENTRYPOINT ["/tini", "--"] + USER "www-data" +CMD [ "docker-php-entrypoint", "apache2-foreground" ] + HEALTHCHECK --interval="10s" \ CMD curl --fail "http://localhost:8080" || exit 1 From 13cc73d0f57f3799fb7a01d5e0f9f1a681e31240 Mon Sep 17 00:00:00 2001 From: Julien Cabillot Date: Mon, 6 Nov 2017 17:12:19 +0100 Subject: [PATCH 10/12] utilisation de registry.cabillot.eu/www/phpapache --- Dockerfile | 36 +----------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0700307..4bc4e76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,37 +1,3 @@ -FROM "php:7.1-apache" - -RUN sed -i'' 's/^Listen 80$/Listen 8080/' "/etc/apache2/ports.conf" && \ - sed -i'' 's/^$//' '/etc/apache2/sites-enabled/000-default.conf' && \ - { \ - echo 'RemoteIPHeader X-Real-IP'; \ - echo 'RemoteIPProxiesHeader X-Forwarded-By'; \ - } | tee "$APACHE_CONFDIR/conf-available/remoteip.conf" && \ - a2enconf remoteip && \ - a2enmod remoteip && \ - apt-get -y autoremove --purge && \ - apt-get -y clean all && \ - rm -rf "/usr/share/doc/*" \ - "/var/cache/*" \ - "/var/lib/apt/lists/*" \ - "/usr/src/*" \ - "/var/cache/*" \ - "/var/log/"{apt/*,dpkg.log} \ - "/var/www/html" \ - "/tmp/*" +FROM "registry.cabillot.eu/www/phpapache" COPY "root" "/var/www/html" - -RUN chown -R "www-data":"www-data" "/var/www/html" - -# Add Tini -ENV "TINI_VERSION" "v0.16.1" -ADD "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini" "/tini" -RUN chmod +x "/tini" -ENTRYPOINT ["/tini", "--"] - -USER "www-data" - -CMD [ "docker-php-entrypoint", "apache2-foreground" ] - -HEALTHCHECK --interval="10s" \ - CMD curl --fail "http://localhost:8080" || exit 1 From cefd9d52c8df3bc9a7542aad899451dc7337912b Mon Sep 17 00:00:00 2001 From: Julien Cabillot Date: Tue, 7 Nov 2017 09:33:48 +0100 Subject: [PATCH 11/12] choix de l'image par env --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4bc4e76..1af2227 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,5 @@ -FROM "registry.cabillot.eu/www/phpapache" +ARG VERSION="latest" +FROM "registry.cabillot.eu/www/phpapache:${VERSION}" +MAINTAINER "Julien Cabillot " COPY "root" "/var/www/html" From 99d89a5d5a7d57ee9a8d322807eb53b95aeccefa Mon Sep 17 00:00:00 2001 From: Julien Cabillot Date: Tue, 7 Nov 2017 11:58:33 +0000 Subject: [PATCH 12/12] Update index.php --- root/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/root/index.php b/root/index.php index 7687e2c..76eca32 100644 --- a/root/index.php +++ b/root/index.php @@ -1,3 +1,4 @@