Skip to content
This repository has been archived by the owner on Jun 9, 2020. It is now read-only.

Commit

Permalink
Updated from PHP 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gboddin committed Jun 24, 2018
2 parents 922a910 + 4dda4e0 commit 17fc4e5
Show file tree
Hide file tree
Showing 10 changed files with 500 additions and 24 deletions.
33 changes: 24 additions & 9 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
workspace:
base: /${DRONE_BRANCH%%/*}
path: ${DRONE_BRANCH##*/}

pipeline:
build-and-push-image:
# Build and push tags :
build-and-push:
image: plugins/docker
repo: fpfis/httpd-php
auto_tag: true
secrets: [ DOCKER_USERNAME, DOCKER_PASSWORD ]
when:
event: tag

# Build and push dev release
build-and-push-branch:
image: plugins/docker
repo: fpfis/httpd-php
tags: [ 5 , 5.6 ]
# - ${DRONE_BRANCH:8:1}
# - ${DRONE_BRANCH##*/}
secrets: [ docker_username, docker_password ]
tags: ${DRONE_BRANCH##*/}
secrets: [ DOCKER_USERNAME, DOCKER_PASSWORD ]
when:
event: push
branch: release/*

# Mark production
build-and-push-production:
image: plugins/docker
repo: fpfis/httpd-php
tags: production-${DRONE_BRANCH##*/}
secrets: [ DOCKER_USERNAME, DOCKER_PASSWORD ]
when:
event: push
branch: production/*
33 changes: 27 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:5-fpm-alpine
FROM php:5.6-fpm-alpine

ENV DOCUMENT_ROOT /var/www/html

Expand All @@ -8,14 +8,30 @@ ENV APACHE_EXTRA_CONF ""

ENV APACHE_EXTRA_CONF_DIR ""

ENV APACHE_ERROR_LOG /dev/fd/2

ENV APACHE_ACCESS_LOG /dev/fd/1

ENV FPM_MIN_CHILDREN 3

ENV FPM_MAX_CHILDREN 5

ENV PHP_ERROR_LOG /dev/fd/2

ENV DAEMON_USER "www-data"

ENV DAEMON_GROUP "www-data"

### Add ssmtp
RUN apk add --no-cache ssmtp

# Install PHP Modules
RUN curl https://raw.githubusercontent.com/fpfis/httpd-php/release/5.6/install-ext-modules.sh | /bin/sh
ADD install-ext-modules.sh /install-ext-modules.sh
RUN /install-ext-modules.sh && \
ln -s /usr/local/etc/ /etc/php

RUN ln -s /usr/local/etc/ /etc/php
ADD phpfpm_conf/www.conf /etc/php/php-fpm.d/
ADD php_conf/ /usr/local/etc/php/conf.d/

ADD phpfpm_conf/www.conf /etc/php/php-fpm.d/

Expand All @@ -26,19 +42,24 @@ ADD apache2_conf/ /etc/apache2/

RUN ln -s /usr/lib/apache2/ /etc/apache2/modules

RUN rm /etc/apache2/conf.d/mpm.conf
### Clean upstream config
RUN rm /etc/apache2/conf.d/mpm.conf && \
rm /usr/local/etc/php-fpm.d/zz-docker.conf

### Fix iconv
RUN apk add gnu-libiconv --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php

### Add monit
RUN apk add --no-cache monit

ADD monitrc /etc/monitrc

RUN chmod 700 /etc/monitrc
RUN chmod 700 /etc/monitrc

ADD run.sh /

EXPOSE 8080
EXPOSE 2812

ENTRYPOINT ["/run.sh"]

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# httpd-php
Alpine 3.7

Apache + PHP 5.6
Apache + PHP 5.6

Monit

Expand Down
2 changes: 1 addition & 1 deletion apache2_conf/conf.d/php.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/${DOCUMENT_ROOT}/$1
DirectoryIndex /index.php index.php
DirectoryIndex index.php index.html
2 changes: 2 additions & 0 deletions apache2_conf/conf.d/prod.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ServerTokens Prod
ServerSignature Off
6 changes: 3 additions & 3 deletions apache2_conf/httpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ DocumentRoot ${DOCUMENT_ROOT}
Require all denied
</Files>

ErrorLog /dev/fd/2
TransferLog /dev/fd/1
ErrorLog ${APACHE_ERROR_LOG}
TransferLog ${APACHE_ACCESS_LOG}
LogLevel notice

<IfModule log_config_module>
Expand Down Expand Up @@ -86,4 +86,4 @@ ${APACHE_EXTRA_CONF}

IncludeOptional ${APACHE_EXTRA_CONF_DIR}/*.conf

IncludeOptional conf.d/*.conf
IncludeOptional conf.d/*.conf
20 changes: 16 additions & 4 deletions install-ext-modules.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

set -xue

modules="bz2 calendar exif gd pdo_mysql opcache zip xsl intl mcrypt ldap "

modules="soap bz2 calendar exif pdo_mysql opcache zip xsl intl mcrypt mbstring ldap sockets "

#Dumb list of dev dependencies...
makedepends="
Expand Down Expand Up @@ -51,14 +50,25 @@ apk add --no-cache --virtual .build-deps $makedepends $PHPIZE_DEPS;

docker-php-source extract;

# GD

docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
docker-php-ext-install gd

# Igbinary

pecl install igbinary;

docker-php-ext-enable igbinary;

echo '' | pecl install memcached-2.2.0;
# Memcached

echo '' | pecl install memcached;

cd /tmp;

# Redis

pecl bundle redis;

cd redis;
Expand All @@ -75,8 +85,10 @@ docker-php-source delete;

docker-php-ext-enable redis;

# Others

docker-php-ext-install $modules;

apk add --no-cache $( scanelf --needed --nobanner --format '%n#p' --recursive /usr/local | tr ',' '\n' | sort -u | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' );

apk del .build-deps
apk del .build-deps
5 changes: 5 additions & 0 deletions php_conf/90-common.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
max_execution_time = 30
max_input_time = 30
memory_limit = 512M
log_errors=On
error_log=${PHP_ERROR_LOG}
2 changes: 2 additions & 0 deletions php_conf/95-prod.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
expose_php=Off
display_errors=Off
Loading

0 comments on commit 17fc4e5

Please sign in to comment.