From f82c1976289ef6b6ec13f990761c30440d21d846 Mon Sep 17 00:00:00 2001 From: David Beniamine <david.beniamine@tetras-libre.fr> Date: Fri, 27 Mar 2020 17:49:05 +0100 Subject: [PATCH] Pretty Noemie image building TODO : + manage multiple sites + import sites procedure --- .env.sample | 3 +++ .gitignore | 3 +++ docker-compose.yml | 17 +++++++++++++++++ docker/Dockerfile | 29 +++++++++++++++++++++++++++++ docker/install_composer.sh | 20 ++++++++++++++++++++ 5 files changed, 72 insertions(+) create mode 100644 .env.sample create mode 100644 .gitignore create mode 100644 docker-compose.yml create mode 100644 docker/Dockerfile create mode 100755 docker/install_composer.sh diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000..9df544f --- /dev/null +++ b/.env.sample @@ -0,0 +1,3 @@ +# Docker +PORT=8000 +RESTART=no diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e9aceec --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.env +.sw? +html/* diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..85025bd --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +version: '2' + +services: + + front: + build: ./docker + volumes: + - 'noemie:/var/www/html/PrettyNoemieCMS' + environment: + restart: ${RESTART} + PHP_INI_DATE_TIMEZONE: 'Europe/Paris' + ports: + - "${PORT}:80" + restart: ${RESTART} + +volumes: + noemie: diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..6f28264 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,29 @@ +FROM php:7.3-apache + +RUN apt-get update && apt-get install -y \ + curl \ + git \ + libcurl4-gnutls-dev \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libpng-dev \ + libxml2-dev \ + libzip-dev \ + wget + +RUN docker-php-ext-install -j$(nproc) gd curl mbstring xml zip + +COPY install_composer.sh / +RUN /bin/bash /install_composer.sh +RUN rm /install_composer.sh + +#COPY noemie.conf /etc/apache2/sites-enabled/000-default.conf + +WORKDIR /var/www/html +RUN git clone https://framagit.org/framasoft/PrettyNoemieCMS +WORKDIR /var/www/html/PrettyNoemieCMS +RUN /usr/local/bin/composer.phar install +RUN chown -R www-data /var/www/html/PrettyNoemieCMS +WORKDIR /var/www/html + +RUN a2enmod rewrite diff --git a/docker/install_composer.sh b/docker/install_composer.sh new file mode 100755 index 0000000..effb763 --- /dev/null +++ b/docker/install_composer.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)" +php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" +ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');" 2>/dev/null)" + +if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ] +then + >&2 echo 'ERROR: Invalid installer signature' + echo "Expected $EXPECTED_SIGNATURE" + echo "Got $ACTUAL_SIGNATURE" + rm composer-setup.php + exit 1 +fi + +php composer-setup.php --install-dir=/usr/local/bin +RESULT=$? +rm composer-setup.php +exit $RESULT + -- GitLab