This repository has been archived by the owner on Jun 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from fpfis/develop
Release ubuntu images
- Loading branch information
Showing
16 changed files
with
392 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
matrix: | ||
include: | ||
- PHP_VERSION: 7.2 | ||
TARGET: httpd-php | ||
- PHP_VERSION: 7.2 | ||
TARGET: httpd-php-dev | ||
OCI8_VERSION: 2.1.8 | ||
- PHP_VERSION: 7.2 | ||
OCI8_VERSION: 2.1.8 | ||
TARGET: httpd-php-full | ||
- PHP_VERSION: 7.1 | ||
TARGET: httpd-php | ||
- PHP_VERSION: 7.1 | ||
TARGET: httpd-php-dev | ||
OCI8_VERSION: 2.1.8 | ||
- PHP_VERSION: 7.1 | ||
OCI8_VERSION: 2.1.8 | ||
TARGET: httpd-php-full | ||
- PHP_VERSION: 5.6 | ||
TARGET: httpd-php | ||
- PHP_VERSION: 5.6 | ||
TARGET: httpd-php-dev | ||
OCI8_VERSION: 2.0.12 | ||
- PHP_VERSION: 5.6 | ||
OCI8_VERSION: 2.0.12 | ||
TARGET: httpd-php-full | ||
|
||
|
||
pipeline: | ||
# Build and push release | ||
build-and-push-branch: | ||
image: plugins/docker | ||
repo: fpfis/${TARGET} | ||
tags: ${PHP_VERSION} | ||
secrets: [ DOCKER_USERNAME, DOCKER_PASSWORD ] | ||
target: ${TARGET} | ||
build_args: | ||
- php_version=${PHP_VERSION} | ||
- oci8_version=${OCI8_VERSION} | ||
when: | ||
event: push | ||
branch: develop | ||
|
||
# Mark production | ||
build-and-push-production: | ||
image: plugins/docker | ||
repo: fpfis/${TARGET} | ||
tags: production-${PHP_VERSION} | ||
target: ${TARGET} | ||
secrets: [ DOCKER_USERNAME, DOCKER_PASSWORD ] | ||
build_args: | ||
- php_version=${PHP_VERSION} | ||
- oci8_version=${OCI8_VERSION} | ||
when: | ||
event: push | ||
branch: master | ||
|
||
# Mark production | ||
build-and-push-tag: | ||
image: plugins/docker | ||
repo: fpfis/${TARGET} | ||
tags: | ||
- ${PHP_VERSION} | ||
- ${DRONE_TAG%.*} | ||
- ${DRONE_TAG} | ||
target: ${TARGET} | ||
secrets: [ DOCKER_USERNAME, DOCKER_PASSWORD ] | ||
build_args: | ||
- php_version=${PHP_VERSION} | ||
- oci8_version=${OCI8_VERSION} | ||
when: | ||
event: tag | ||
matrix: | ||
PHP_VERSION: ${DRONE_TAG%.*} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
## Base PHP image : | ||
|
||
FROM ubuntu as httpd-php | ||
|
||
# Build arguments | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
ARG php_version="5.6" | ||
ARG php_modules="curl soap bz2 calendar exif mysql opcache zip xsl intl mcrypt yaml mbstring ldap sockets iconv gd redis memcached tidy" | ||
ARG apache2_modules="proxy_fcgi setenvif rewrite" | ||
ARG USER_ID=1000 | ||
ARG GROUP_ID=1000 | ||
|
||
# Default configuration and environment | ||
ENV php_version=${php_version} \ | ||
FPM_MAX_CHILDREN=5 \ | ||
FPM_MIN_CHILDREN=2 \ | ||
DAEMON_USER=www-data \ | ||
DAEMON_GROUP=www-data \ | ||
HTTP_PORT=8080 \ | ||
APACHE_ERROR_LOG=/proc/self/fd/2 \ | ||
APACHE_ACCESS_LOG=/proc/self/fd/1 \ | ||
PHP_MAX_EXECUTION_TIME=30 \ | ||
PHP_MAX_INPUT_TIME=30 \ | ||
PHP_MEMORY_LIMIT=512M \ | ||
DOCUMENT_ROOT=/var/www/html | ||
|
||
# Add our setup scripts and run the base one | ||
ADD scripts /scripts | ||
RUN /scripts/install-base.sh | ||
|
||
# Add our specific configuration | ||
ADD supervisor_conf /etc/supervisor/conf.d | ||
ADD apache2_conf /etc/apache2 | ||
ADD php_conf /etc/php/${php_version}/mods-available | ||
ADD phpfpm_conf /etc/php/${php_version}/fpm/pool.d | ||
|
||
# Enable our specific configuration | ||
RUN phpenmod 90-common 95-prod && \ | ||
phpenmod -s cli 95-cli && \ | ||
a2enmod ${apache2_modules} && \ | ||
a2enconf php${php_version}-fpm prod | ||
ENTRYPOINT ["/scripts/run.sh"] | ||
|
||
## Full PHP images ( adds Java, OCI, and other heavy runtime libs ) | ||
FROM httpd-php as httpd-php-full | ||
ARG oci8_version="2.0.12" | ||
ENV oci8_version=${oci8_version} | ||
RUN /scripts/install-full.sh | ||
|
||
## Based on the full image ( adds developement tools ) | ||
FROM httpd-php-full as httpd-php-dev | ||
ARG composer_version="1.7.2" | ||
ARG drush_version="8.1.17" | ||
ENV PATH=${PATH}:/root/.composer/vendor/bin | ||
ENV COMPOSER_ALLOW_SUPERUSER=1 | ||
ENV PHP_MEMORY_LIMIT=2G | ||
RUN /scripts/install-dev.sh && \ | ||
phpdismod 95-prod && \ | ||
phpenmod 95-dev && \ | ||
a2disconf prod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,17 @@ | ||
# httpd-php | ||
Apache + PHP Docker images | ||
Alpine 3.7 | ||
|
||
Apache + PHP 5.6 | ||
|
||
Monit | ||
|
||
Apache Variables: | ||
|
||
`DAEMON_USER` User that will run Apache and PHP. Defaults to www-data | ||
`DAEMON_GROUP` Daemon group. Defaults to www-data | ||
`DOCUMENT_ROOT` Document Root. Defaults to /var/www/html | ||
|
||
|
||
Module list: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
ServerRoot "/etc/apache2" | ||
PidFile /run/apache2.pid | ||
Listen ${HTTP_PORT} | ||
|
||
User ${DAEMON_USER} | ||
Group ${DAEMON_GROUP} | ||
|
||
|
||
ServerAdmin root@localhost | ||
|
||
# Include module configuration: | ||
IncludeOptional mods-enabled/*.load | ||
IncludeOptional mods-enabled/*.conf | ||
|
||
<Directory /> | ||
AllowOverride none | ||
Require all denied | ||
</Directory> | ||
|
||
|
||
DocumentRoot ${DOCUMENT_ROOT} | ||
|
||
<Directory "/var/www"> | ||
AllowOverride All | ||
Require all granted | ||
</Directory> | ||
|
||
<Directory "${DOCUMENT_ROOT}"> | ||
Options Indexes FollowSymLinks | ||
|
||
AllowOverride All | ||
|
||
Require all granted | ||
</Directory> | ||
|
||
<IfModule dir_module> | ||
DirectoryIndex index.html | ||
</IfModule> | ||
|
||
<Files ".ht*"> | ||
Require all denied | ||
</Files> | ||
|
||
ErrorLog ${APACHE_ERROR_LOG} | ||
TransferLog ${APACHE_ACCESS_LOG} | ||
LogLevel notice | ||
|
||
<IfModule log_config_module> | ||
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined | ||
LogFormat "%h %l %u %t \"%r\" %>s %b" common | ||
|
||
<IfModule logio_module> | ||
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio | ||
</IfModule> | ||
|
||
</IfModule> | ||
|
||
<IfModule alias_module> | ||
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" | ||
</IfModule> | ||
|
||
<Directory "/var/www/cgi-bin"> | ||
AllowOverride None | ||
Options None | ||
Require all granted | ||
</Directory> | ||
|
||
<IfModule mime_module> | ||
TypesConfig /etc/mime.types | ||
|
||
AddType application/x-compress .Z | ||
AddType application/x-gzip .gz .tgz | ||
|
||
AddType text/html .shtml | ||
AddOutputFilter INCLUDES .shtml | ||
</IfModule> | ||
|
||
AddDefaultCharset UTF-8 | ||
|
||
<IfModule mime_magic_module> | ||
MIMEMagicFile conf/magic | ||
</IfModule> | ||
|
||
|
||
EnableSendfile on | ||
|
||
|
||
# Include of directories ignores editors' and dpkg's backup files, | ||
# Include generic snippets of statements | ||
IncludeOptional conf-enabled/*.conf | ||
|
||
# Allow to provide files through volumes | ||
IncludeOptional /etc/apache2/conf.d/*.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ServerTokens Prod | ||
ServerSignature Off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
date.timezone = Europe/Brussels | ||
max_execution_time = ${PHP_MAX_EXECUTION_TIME} | ||
max_input_time = ${PHP_MAX_INPUT_TIME} | ||
memory_limit = ${PHP_MEMORY_LIMIT} | ||
log_errors=On |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
memory_limit = 4G |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
expose_php=On | ||
display_errors=On | ||
sendmail_path = /bin/true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
expose_php=Off | ||
display_errors=Off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[www] | ||
|
||
user = ${DAEMON_USER} | ||
group = ${DAEMON_USER} | ||
|
||
listen = /run/php/php${php_version}-fpm.sock | ||
listen.group = ${DAEMON_USER} | ||
listen.owner = ${DAEMON_USER} | ||
|
||
pm = dynamic | ||
pm.max_children = ${FPM_MAX_CHILDREN} | ||
pm.min_spare_servers = ${FPM_MIN_CHILDREN} | ||
pm.max_spare_servers = ${FPM_MAX_CHILDREN} | ||
|
||
access.log = /proc/self/fd/1 | ||
clear_env = no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!bin/bash | ||
set -e | ||
set -x | ||
|
||
# Fix www-data uid/gid : | ||
usermod -u ${USER_ID} www-data | ||
groupmod -g ${GROUP_ID} www-data | ||
|
||
apt-get update | ||
apt-get install -y software-properties-common | ||
add-apt-repository -y ppa:ondrej/php | ||
|
||
for module in ${php_modules}; do | ||
if [ "${php_version}" == "7.2" ] && [ "${module}" == "mcrypt" ]; then | ||
echo "WARNING: ${module} not supported on 7.2" | ||
continue | ||
fi | ||
modules="php${php_version}-${module} ${modules}" | ||
done | ||
|
||
apt-get install -y supervisor apache2 php${php_version}-fpm ${modules} | ||
|
||
apt-get autoremove software-properties-common -y --purge | ||
apt-get clean | ||
rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!bin/bash | ||
set -e | ||
set -x | ||
apt-get update | ||
|
||
# Install dev packages : | ||
apt-get install -y php${php_version}-xdebug wget unzip patch git | ||
|
||
# Install PHP dev packages : | ||
wget https://github.com/composer/composer/releases/download/${composer_version}/composer.phar -O /usr/bin/composer | ||
wget https://github.com/drush-ops/drush/releases/download/${drush_version}/drush.phar -O /usr/bin/drush | ||
ln -s /usr/bin/composer /usr/local/bin/composer | ||
chmod +x /usr/bin/composer /usr/bin/drush | ||
|
||
apt-get clean | ||
rm -rf /var/lib/apt/lists/* | ||
rm -rf /tmp/* | ||
rm -Rf /root/.composer/cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!bin/bash | ||
set -e | ||
set -x | ||
apt-get update | ||
|
||
# Fix java installation | ||
mkdir -p /usr/share/man/man1 | ||
apt-get install --no-install-recommends -y libaio1 openjdk-8-jre-headless curl unzip mysql-client | ||
|
||
# OCI8 deps : | ||
curl https://repo.ne-dev.eu/deb/instantclient-basic-linux.x64-12.2.0.1.0.zip > /tmp/instantclient-basic-linux.zip | ||
unzip /tmp/instantclient-basic-linux.zip -d /usr/local/ | ||
curl https://repo.ne-dev.eu/deb/instantclient-sdk-linux.x64-12.2.0.1.0.zip > /tmp/instantclient-sdk-linux.zip | ||
unzip /tmp/instantclient-sdk-linux.zip -d /usr/local/ | ||
ln -s /usr/local/instantclient_12_2/libclntsh.so.12.1 /usr/local/instantclient_12_2/libclntsh.so | ||
echo /usr/local/instantclient_12_2 > /etc/ld.so.conf.d/oracle-instantclient.conf && ldconfig | ||
|
||
# OCI8 build : | ||
apt-get install -y php${php_version}-dev | ||
pecl download oci8-${oci8_version} | ||
tar -xzvf oci8-${oci8_version}.tgz | ||
pushd oci8-${oci8_version} | ||
phpize | ||
./configure --with-oci8=instantclient,/usr/local/instantclient_12_2 | ||
make -j$(nproc) | ||
make install | ||
popd | ||
rm -Rf oci8-${oci8_version} oci8-${oci8_version}.tar.gz | ||
echo "extension=oci8.so" > /etc/php/${php_version}/mods-available/oci8.ini | ||
phpenmod oci8 | ||
|
||
# Clean : | ||
apt-get autoremove -y curl unzip php${php_version}-dev --purge | ||
apt-get clean | ||
rm -rf /var/lib/apt/lists/* | ||
rm -rf /tmp/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# Get uid for the current docroot | ||
[ -z "${DOCUMENT_ROOT}" ] && export DOCUMENT_ROOT=/var/www/html | ||
|
||
# Check if docroot or parent exists : | ||
[ -d "${DOCUMENT_ROOT}" ] && export REF_DIR=${DOCUMENT_ROOT} | ||
# Else use its parent | ||
[ -z "${REF_DIR}" ] && export REF_DIR=$(dirname ${DOCUMENT_ROOT}) | ||
|
||
# Get our command to run | ||
export CMD=$@ | ||
|
||
[ ! -d /run/php ] && mkdir /run/php | ||
[ ! -d /run/apache2 ] && mkdir /run/apache2 | ||
|
||
|
||
if [ -z "${CMD}" ]; then | ||
# As root, let daemon handle the rest | ||
supervisord -nc /etc/supervisor/supervisord.conf | ||
else | ||
# TODO : us ref_dir's permissions to use it's UID | ||
exec ${CMD} | ||
fi |
Oops, something went wrong.