Skip to content

Commit 5de3719

Browse files
authored
Merge pull request #69 from ucfopen/issue/docker-env-update-memcache-and-php
update docker php to 7.4 and some minor associated fixes
2 parents 930bf85 + 2d407de commit 5de3719

File tree

5 files changed

+51
-27
lines changed

5 files changed

+51
-27
lines changed

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ services:
4141
- "./internal/docker/05_wordpress_data.sql:/docker-entrypoint-initdb.d/05.sql"
4242

4343
memcached:
44-
image: memcached:1.4.27-alpine
44+
image: memcached:1.6.7-alpine

internal/classes/rocketD/db/DBConnectionMYSQLI.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected function smartQuote($value)
8282
$value = stripslashes($value);
8383
}
8484
// Quote if not integer
85-
if (!is_numeric($value) || $value[0] == '0')
85+
if (!is_numeric($value) || ( isset($value[0]) && $value[0] == '0' ) )
8686
{
8787
$newvalue = mysqli_real_escape_string($this->connData->connID, $value);
8888
$value = $newvalue;

internal/config/cfgLocal.docker.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ class AppCfg extends AppCfgDefault
1212
const DB_USER = 'obojobo_user';
1313
const DB_PASS = 'obojobo_pass';
1414
const DB_NAME = 'obojobo';
15-
const DB_TYPE = 'mysql';
15+
const DB_TYPE = 'mysqli';
1616

1717
// --- Wordpress DB Connection ---
1818
const DB_WP_HOST = 'mysql';
1919
const DB_WP_USER = 'obojobo_user';
2020
const DB_WP_PASS = 'obojobo_pass';
2121
const DB_WP_NAME = 'obojobo_wordpress';
22-
const DB_WP_TYPE = 'mysql';
22+
const DB_WP_TYPE = 'mysqli';
2323

2424

2525
// --- WORDPRESS keys ---

internal/docker/dockerfile-obojobo

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,47 @@
1-
FROM php:5.6.19-fpm-alpine
2-
MAINTAINER Ian Turgeon
1+
FROM php:7.4-fpm-alpine
2+
MAINTAINER UCF/Open_
33

4-
RUN apk --no-cache add \
5-
git \
6-
libjpeg-turbo-dev\
7-
libmcrypt-dev \
8-
libpng-dev \
9-
libxml2-dev
4+
ARG PHP_EXT="bcmath gd xml mysqli"
5+
ARG PECL="mcrypt-1.0.3"
6+
ARG PHP_EXT_ENABLE="memcache mcrypt"
7+
ARG PHP_MEMCACHED_VERSION="4.0.5.2"
8+
ARG COMPOSER_VERSION="1.10.0"
9+
ARG COMPOSER_INSTALLER_URL="https://raw.githubusercontent.com/composer/getcomposer.org/d2c7283f9a7df2db2ab64097a047aae780b8f6b7/web/installer"
10+
ARG COMPOSER_INSTALLER_SHA="e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a"
1011

11-
# PECL Libraries and php extensions
12-
RUN docker-php-ext-configure gd --with-jpeg-dir=/usr/include/ \
13-
&& pecl install memcache \
14-
&& docker-php-ext-enable memcache \
15-
&& docker-php-ext-install \
16-
bcmath \
17-
gd \
18-
mbstring \
19-
mcrypt \
20-
mysql \
21-
mysqlnd \
22-
xml \
23-
&& rm -rf /usr/src/php
12+
# os packages needed for php extensions
13+
ARG BUILD_PACKAGES="autoconf bash build-base cyrus-sasl-dev freetype git libjpeg-turbo-dev libmemcached-dev libpng-dev libxml2-dev libmcrypt-dev"
14+
ARG PURGE_PACKAGES="autoconf build-base cyrus-sasl-dev freetype libjpeg-turbo-dev"
15+
ARG PURGE_FILES="/var/lib/apt/lists/* /usr/src/php /usr/include /usr/local/include /usr/share/doc /usr/share/doc-base /var/www/html/php-memcached"
2416

25-
# Make sure composer is installed globally
26-
RUN ash -c "curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer"
17+
RUN apk add --no-cache $BUILD_PACKAGES \
18+
# ======== PHP CONFIGURE GD
19+
&& docker-php-ext-configure gd --with-jpeg=/usr/include \
20+
# ======== PECL INSTALL
21+
&& pecl install $PECL \
22+
# ======== PHP EXTENSIONS
23+
&& docker-php-ext-install $PHP_EXT \
24+
# ======== PHP-MEMCACHED
25+
&& git clone -b $PHP_MEMCACHED_VERSION https://github.com/websupport-sk/pecl-memcache.git \
26+
&& cd pecl-memcache \
27+
&& phpize \
28+
&& ./configure \
29+
&& make \
30+
&& make install \
31+
# ======= ENABLE PECL AND COMPILED EXTENSIONS \
32+
&& docker-php-ext-enable $PHP_EXT_ENABLE \
33+
# ======== PHP COMPOSER
34+
&& php -r "copy('$COMPOSER_INSTALLER_URL', 'composer-setup.php');" \
35+
&& php -r "if (hash_file('sha384', 'composer-setup.php') === '$COMPOSER_INSTALLER_SHA') { echo 'COMPOSER VERIFIED'; } else { echo 'COMPOSER INVALID'; exit(1); } echo PHP_EOL;" \
36+
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer --version=$COMPOSER_VERSION \
37+
&& rm -f composer-setup.php \
38+
# ======== CLEANUP
39+
&& apk del $PURGE_PACKAGES \
40+
&& rm -rf $PURGE_FILES
41+
42+
# hack to let php write to the shared disk with boot2docker shares
43+
# files shared from host into a container appear to use a user on host with UID 1000
44+
# looks like this container not only doesnt have a user at 1000, but the www-data user cant write to these files
45+
# so, this changes www-data's uid to 1000
46+
# RUN usermod -u 1000 www-data
47+
RUN sed -i "s/^www-data:x:[0-9]*/www-data:x:1000/" /etc/passwd

internal/generate_password.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,8 @@
2121
echo("\n=============== SQL for password '$argv[2]' =============\r\n");
2222
}
2323

24+
$now = time();
25+
2426
echo("INSERT INTO `obo_user_meta` (`userID`, `meta`, `value`) VALUES ('$argv[1]', 'salt', '$salt') ON DUPLICATE KEY UPDATE `value` = '$salt';\r\n");
2527
echo("INSERT INTO `obo_user_meta` (`userID`, `meta`, `value`) VALUES ('$argv[1]', 'password', '$dbPassword') ON DUPLICATE KEY UPDATE `value` = '$dbPassword';\r\n");
28+
echo("INSERT INTO `obo_user_meta` (`userID`, `meta`, `value`) VALUES ('$argv[1]', 'lastPassChange', '$now') ON DUPLICATE KEY UPDATE `value` = '$now';\r\n");

0 commit comments

Comments
 (0)