Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile converted to Alpine Linux based image and PHP7 #13

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 27 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
FROM php:5.6-fpm
FROM php:7.0-fpm-alpine

RUN apt-get update && apt-get install -y \
bzip2 \
libcurl4-openssl-dev \
libfreetype6-dev \
libicu-dev \
libjpeg-dev \
libmcrypt-dev \
libmemcached-dev \
libpng12-dev \
libpq-dev \
libxml2-dev \
&& rm -rf /var/lib/apt/lists/*

# https://docs.nextcloud.com/server/9/admin_manual/installation/source_installation.html
RUN docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-install gd exif intl mbstring mcrypt mysql opcache pdo_mysql pdo_pgsql pgsql zip
ENV NEXTCLOUD_VERSION 10.0.0

# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
Expand All @@ -28,22 +13,40 @@ RUN { \
echo 'opcache.enable_cli=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini

# PECL extensions
# Install PHP extensions
# https://docs.nextcloud.com/server/9/admin_manual/installation/source_installation.html
RUN set -ex \
&& pecl install APCu-4.0.10 \
&& pecl install memcached-2.2.0 \
&& pecl install redis-2.2.8 \
&& docker-php-ext-enable apcu redis memcached
&& apk update \
&& apk add build-base python-dev py-pip jpeg-dev jpeg zlib zlib-dev \
postgresql-dev libmcrypt-dev libmcrypt libpng-dev libpng \
autoconf make g++ gcc git file gnupg re2c icu icu-dev tzdata \
#&& echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
#&& echo '@community http://nl.alpinelinux.org/alpine/edge/community' >> /etc/apk/repositories \
#&& apk add php7-session@community \
#&& apk add php7-memcached@testing \
&& docker-php-ext-install gd exif intl mbstring mcrypt opcache pdo_mysql pdo_pgsql pgsql zip \
&& docker-php-ext-enable gd intl exif mbstring mcrypt opcache pdo_mysql pdo_pgsql pgsql zip \
&& pecl install APCu-5.1.6 \
&& git clone https://github.com/phpredis/phpredis.git \
&& cd phpredis \
&& git checkout php7 \
&& phpize \
&& ./configure \
&& make && make install \
&& cd .. \
&& rm -rf phpredis \
&& docker-php-ext-enable redis apcu \
&& apk del autoconf make g++ gcc git py-pip zlib-dev jpeg-dev libmcrypt-dev libpng-dev\
&& rm -rf /var/cache/apk/*

ENV NEXTCLOUD_VERSION 10.0.0
VOLUME /var/www/html

RUN curl -fsSL -o nextcloud.tar.bz2 \
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2" \
&& curl -fsSL -o nextcloud.tar.bz2.asc \
"https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VERSION}.tar.bz2.asc" \
&& export GNUPGHOME="$(mktemp -d)" \
# gpg key from https://nextcloud.com/nextcloud.asc
# gpg key from https://nextcloud.com/nextcloud.asc
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 28806A878AE423A28372792ED75899B9A724937A \
&& gpg --batch --verify nextcloud.tar.bz2.asc nextcloud.tar.bz2 \
&& rm -r "$GNUPGHOME" nextcloud.tar.bz2.asc \
Expand Down
6 changes: 5 additions & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#!/bin/bash
#!/bin/ash
set -e

if [ ! -e '/var/www/html/version.php' ]; then
tar cf - --one-file-system -C /usr/src/nextcloud . | tar xf -
chown -R www-data /var/www/html
fi

if [ -n "$TZ"]; then
cp /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
fi

exec "$@"