From a67f02029532c38b7ffcb24d1d733fd2a9b082ab Mon Sep 17 00:00:00 2001 From: David Losada Date: Mon, 2 Dec 2019 14:52:52 +0100 Subject: [PATCH 1/4] add docker bits --- .dockerignore | 2 ++ Dockerfile | 44 ++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 27 +++++++++++++++++++++++++++ docker/entrypoint.sh | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 109 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 docker/entrypoint.sh diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..d436eaba1f --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.git + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..933d8fb799 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,44 @@ +FROM php:5.5-apache + +ENV DOCKERIZE_VERSION v0.6.1 +RUN apt-get update && \ + apt-get upgrade -y && \ + apt-get install -y \ + wget \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libpng-dev \ + libmcrypt-dev \ + libc-client2007e-dev \ + libkrb5-dev \ + libcurl4-openssl-dev \ + libzip-dev \ + gettext-base \ + unzip \ + rsync \ + git \ + bison \ + netcat && \ + docker-php-ext-install mcrypt bcmath pdo_mysql mysqli zip && \ + docker-php-ext-configure imap --with-kerberos --with-imap-ssl && \ + docker-php-ext-install imap && \ + docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \ + docker-php-ext-install gd && \ + wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && \ + tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && \ + rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +WORKDIR /var/www/html/ +COPY ./ /var/www/html/ +RUN chmod -R 777 application/config && \ + chmod -R 777 application/cache && \ + chmod -R 777 application/logs && \ + chmod -R 777 media/uploads && \ + chmod 644 .htaccess + +COPY docker/entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "/bin/bash", "/entrypoint.sh" ] +CMD [ "apache2-foreground" ] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000..0227333994 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,27 @@ +version: "2" +services: + mysql: + image: mysql:5.5 + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: ushahidi + MYSQL_USER: ushahidi + MYSQL_PASSWORD: ushahidi + ports: + - "33062:3306" + volumes: + - ./sql/ushahidi.sql:/docker-entrypoint-initdb.d/01-ushahidi.sql + platform: + build: . + environment: + DOCKERIZE_TIMEOUT: 180s + DOCKERIZE_WAIT_FOR_mysql: tcp://mysql:3306 + DB_DATABASE: ushahidi + DB_HOST: mysql + DB_PORT: 3306 + DB_USERNAME: ushahidi + DB_PASSWORD: ushahidi + SITE_DEFAULT_KEY: e(W87Gt(pix9)eFPurY)D + # command: start + ports: + - "80:80" diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 0000000000..5441c7d580 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +set -e + +echo "Configuring Ushahidi_Web... " + +cat application/config/auth.template.php \ + > application/config/auth.php + +cat application/config/config.template.php \ + > application/config/config.php + +# DB_USERNAME +# DB_PASSWORD +# DB_HOST +# DB_PORT +# DB_DATABASE + +cat application/config/database.template.php \ + | sed -E -e "s/('user' => )('username')/\\1'${DB_USERNAME}'/" \ + | sed -E -e "s/('pass' => )('password')/\\1'${DB_PASSWORD}'/" \ + | sed -E -e "s/('host' => )('localhost')/\\1'${DB_HOST}'/" \ + | sed -E -e "s/('port' => )(FALSE)/\\1'${DB_PORT:-3306}'/" \ + | sed -E -e "s/('database' => )('db')/\\1'${DB_DATABASE}'/" \ + > application/config/database.php + +# SITE_DEFAULT_KEY + +cat application/config/encryption.template.php \ + | sed -E -e "s/USHAHIDI-INSECURE/${SITE_DEFAULT_KEY:-USHAHIDI-INSECURE}/" \ + > application/config/encryption.php + + +dockerize -wait tcp://${DB_HOST}:${DB_PORT:-3306} -timeout 60s + +exec "$@" From b7f7279462177e98679ebaaeee31265f1e5436de Mon Sep 17 00:00:00 2001 From: David Losada Date: Mon, 2 Dec 2019 14:53:19 +0100 Subject: [PATCH 2/4] fix commit id referenced by submodule --- application/i18n | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/i18n b/application/i18n index fc788997a2..95144fd69d 160000 --- a/application/i18n +++ b/application/i18n @@ -1 +1 @@ -Subproject commit fc788997a2e8a16917da4f96bd9f9856c40bbcd4 +Subproject commit 95144fd69dfe5c9915cbce554bf4b8bac39903e3 From bd35417423b67a8abb7adc2d32cca2f3d2370038 Mon Sep 17 00:00:00 2001 From: David Losada Carballo Date: Thu, 12 Oct 2023 17:46:11 +0200 Subject: [PATCH 3/4] Debian Jessie is in archive. Add dockerize --- Dockerfile | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 933d8fb799..8767a52cfd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,13 @@ FROM php:5.5-apache ENV DOCKERIZE_VERSION v0.6.1 -RUN apt-get update && \ - apt-get upgrade -y && \ - apt-get install -y \ +RUN cat > /etc/apt/sources.list < Date: Fri, 13 Oct 2023 10:49:11 +0200 Subject: [PATCH 4/4] jwilder/dockerize update --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8767a52cfd..7c7ddb1337 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM php:5.5-apache -ENV DOCKERIZE_VERSION v0.6.1 +ENV DOCKERIZE_VERSION v0.7.0 RUN cat > /etc/apt/sources.list <