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

Alpine Linux image with fpm and php7.0 #17

Closed
wants to merge 19 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
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
language: bash
services: docker

env:
- VARIANT=php5.6/fpm
- VARIANT=php7.0/alpine-fpm

install:
- git clone https://github.com/docker-library/official-images.git ~/official-images

before_script:
- env | sort
- cd "$VARIANT"
- slash='/'; image="nextcloud:${VARIANT//$slash/-}"

script:
- docker build -t "$image" .
- ~/official-images/test/run.sh "$image"

after_script:
- docker images

# vim:set et ts=2 sw=2:
67 changes: 67 additions & 0 deletions 10.0/alpine-fpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
FROM php:7.0-fpm-alpine

# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=60'; \
echo 'opcache.fast_shutdown=1'; \
echo 'opcache.enable_cli=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini

# Install PHP extensions
# https://docs.nextcloud.com/server/9/admin_manual/installation/source_installation.html
RUN set -ex \
&& apk update \
&& apk add build-base python-dev py-pip jpeg-dev jpeg \
libldap openldap-dev zlib zlib-dev \
freetype freetype-dev libjpeg-turbo libjpeg-turbo-dev \
postgresql-dev libmcrypt-dev libmcrypt libpng-dev libpng \
autoconf make g++ gcc git file gnupg re2c icu icu-dev tzdata \
&& docker-php-ext-configure gd \
--with-freetype-dir=/usr/include/ \
--with-png-dir=/usr/include \
--with-jpeg-dir=/usr/include \
&& NPROC=$(getconf _NPROCESSORS_ONLN) \
&& docker-php-ext-install -j${NPROC} gd \
&& docker-php-ext-install exif intl mbstring mcrypt opcache \
pdo_mysql pdo_pgsql pgsql zip ldap \
&& docker-php-ext-enable gd exif intl mbstring mcrypt opcache \
pdo_mysql pdo_pgsql pgsql zip ldap \
&& 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 openldap-dev \
freetype-dev libjpeg-turbo-dev \
&& rm -rf /var/cache/apk/*

VOLUME /var/www/html

ENV NEXTCLOUD_VERSION 10.0.3

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 --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 \
&& tar -xjf nextcloud.tar.bz2 -C /usr/src/ \
&& rm nextcloud.tar.bz2

COPY docker-entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"]
13 changes: 13 additions & 0 deletions 10.0/alpine-fpm/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/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 "$@"
67 changes: 67 additions & 0 deletions 11.0/alpine-fpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
FROM php:7.0-fpm-alpine

# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=60'; \
echo 'opcache.fast_shutdown=1'; \
echo 'opcache.enable_cli=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini

# Install PHP extensions
# https://docs.nextcloud.com/server/9/admin_manual/installation/source_installation.html
RUN set -ex \
&& apk update \
&& apk add build-base python-dev py-pip jpeg-dev jpeg \
libldap openldap-dev zlib zlib-dev \
freetype freetype-dev libjpeg-turbo libjpeg-turbo-dev \
postgresql-dev libmcrypt-dev libmcrypt libpng-dev libpng \
autoconf make g++ gcc git file gnupg re2c icu icu-dev tzdata \
&& docker-php-ext-configure gd \
--with-freetype-dir=/usr/include/ \
--with-png-dir=/usr/include \
--with-jpeg-dir=/usr/include \
&& NPROC=$(getconf _NPROCESSORS_ONLN) \
&& docker-php-ext-install -j${NPROC} gd \
&& docker-php-ext-install exif intl mbstring mcrypt opcache \
pdo_mysql pdo_pgsql pgsql zip ldap \
&& docker-php-ext-enable gd exif intl mbstring mcrypt opcache \
pdo_mysql pdo_pgsql pgsql zip ldap \
&& 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 openldap-dev \
freetype-dev libjpeg-turbo-dev \
&& rm -rf /var/cache/apk/*

VOLUME /var/www/html

ENV NEXTCLOUD_VERSION 11.0.1

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 --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 \
&& tar -xjf nextcloud.tar.bz2 -C /usr/src/ \
&& rm nextcloud.tar.bz2

COPY docker-entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm"]
13 changes: 13 additions & 0 deletions 11.0/alpine-fpm/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/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 "$@"
File renamed without changes.
4 changes: 4 additions & 0 deletions docker-entrypoint.sh → php5.6/fpm/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ if [ ! -e '/var/www/html/version.php' ]; then
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 "$@"