Skip to content
Merged
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
43 changes: 0 additions & 43 deletions .checksums.sh

This file was deleted.

7 changes: 4 additions & 3 deletions .git-config/hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

BASE="$(git rev-parse --show-toplevel)"

echo "Fixing permission for ${BASE}..."
echo
echo "🗂 Fixing permission for ${BASE}/..."
find $BASE -type d | xargs -I {} chmod 755 {}
find $BASE -type f | xargs -I {} chmod 644 {}
find $BASE -type f | grep '\/bin\|git-config\/hooks\|cont-init\|services\.d\|\.sh' | xargs -I {} chmod +x {}

echo "Generating checksums for workflow..."
$BASE/.checksums.sh
echo "🤖 Generating checksums for workflow..."
exec $BASE/checksum.sh
56 changes: 28 additions & 28 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
branches:
- main
paths:
- '.checksums.sh'
- 'checksum.sh'
- '.github/workflows/production.yml'
- 'src/**'
schedule:
Expand All @@ -38,8 +38,6 @@ jobs:
matrix:
base:
- ubuntu
s6:
- 3.0.0.2-2
version:
- 20.04
- focal
Expand All @@ -49,19 +47,21 @@ jobs:
DOCKER_BUILDKIT: "1"
steps:
- id: config
run: echo "::set-output name=date::$(date +'%Y%m%d')"
run: |
echo "::set-output name=s6_version::$(cat S6_VERSION.txt)"
echo "::set-output name=date::$(date +'%Y%m%d')"
- uses: actions/checkout@v2
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- run: |
./.checksums.sh
./.git-config/hooks/pre-commit
mkdir -p /tmp/buildx
cat .checksums/base.txt
cat versions/base.txt
- uses: actions/cache@v2
with:
path: /tmp/buildx
key: "${{ runner.os }}-buildx-base-\
${{ hashFiles('.checksums/base.txt') }}"
${{ hashFiles('versions/base.txt') }}"
restore-keys: "${{ runner.os }}-buildx-"
- uses: docker/login-action@v1
with:
Expand All @@ -74,11 +74,11 @@ jobs:
cache-from: type=local,src=/tmp/buildx
cache-to: type=local,dest=/tmp/buildx-new,mode=max
context: "{{defaultContext}}:src/base/"
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
build-args: |
BUILD_NUMBER=${{ steps.config.outputs.date }}-${{ hashFiles('.checksums/base.txt') }}
BUILD_NUMBER=${{ steps.config.outputs.date }}-${{ hashFiles('versions/base.txt') }}
BASE_IMAGE=${{ matrix.base }}:${{ matrix.version }}
S6_VERSION=${{ matrix.s6 }}
S6_VERSION=${{ steps.config.outputs.s6_version }}
tags: |
${{ matrix.image }}:${{ matrix.version }}
${{ matrix.image }}:latest
Expand Down Expand Up @@ -111,15 +111,15 @@ jobs:
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- run: |
./.checksums.sh
./.git-config/hooks/pre-commit
mkdir -p /tmp/buildx
cat .checksums/cli.txt
cat .checksums/fpm.txt
cat versions/cli.txt
cat versions/fpm.txt
- uses: actions/cache@v2
with:
path: /tmp/buildx
key: "${{ runner.os }}-buildx-php-${{ matrix.version }}-\
${{ hashFiles('.checksums/cli.txt') }}"
${{ hashFiles('versions/cli.txt') }}"
restore-keys: "${{ runner.os }}-buildx-"
- uses: docker/login-action@v1
with:
Expand All @@ -132,9 +132,9 @@ jobs:
cache-from: type=local,src=/tmp/buildx
cache-to: type=local,dest=/tmp/buildx,mode=max
context: "{{defaultContext}}:src/php/cli/"
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
build-args: |
BUILD_NUMBER=${{ steps.config.outputs.date }}-${{ hashFiles('.checksums/cli.txt') }}
BUILD_NUMBER=${{ steps.config.outputs.date }}-${{ hashFiles('versions/cli.txt') }}
BASE_IMAGE=shinsenter/s6-ubuntu:focal
PHP_VERSION=${{ matrix.version }}
tags: |
Expand All @@ -149,9 +149,9 @@ jobs:
cache-from: type=local,src=/tmp/buildx
cache-to: type=local,dest=/tmp/buildx-new,mode=max
context: "{{defaultContext}}:src/php/fpm/"
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
build-args: |
BUILD_NUMBER=${{ steps.config.outputs.date }}-${{ hashFiles('.checksums/fpm.txt') }}
BUILD_NUMBER=${{ steps.config.outputs.date }}-${{ hashFiles('versions/fpm.txt') }}
BASE_IMAGE=${{ matrix.image }}
PHP_VERSION=${{ matrix.version }}
tags: |
Expand Down Expand Up @@ -189,14 +189,14 @@ jobs:
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- run: |
./.checksums.sh
./.git-config/hooks/pre-commit
mkdir -p /tmp/buildx
cat .checksums/servers.txt
cat versions/servers.txt
- uses: actions/cache@v2
with:
path: /tmp/buildx
key: "${{ runner.os }}-buildx-php-${{ matrix.version }}-${{ matrix.variation }}-\
${{ hashFiles('.checksums/servers.txt') }}"
${{ hashFiles('versions/servers.txt') }}"
restore-keys: "${{ runner.os }}-buildx-php-${{ matrix.version }}-"
- uses: docker/login-action@v1
with:
Expand All @@ -209,9 +209,9 @@ jobs:
cache-from: type=local,src=/tmp/buildx
cache-to: type=local,dest=/tmp/buildx-new,mode=max
context: "{{defaultContext}}:src/servers/${{ matrix.variation }}/"
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
build-args: |
BUILD_NUMBER=${{ steps.config.outputs.date }}-${{ hashFiles('.checksums/servers.txt') }}
BUILD_NUMBER=${{ steps.config.outputs.date }}-${{ hashFiles('versions/servers.txt') }}
BASE_IMAGE=${{ matrix.image }}
PHP_VERSION=${{ matrix.version }}
tags: |
Expand Down Expand Up @@ -250,14 +250,14 @@ jobs:
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
- run: |
./.checksums.sh
./.git-config/hooks/pre-commit
mkdir -p /tmp/buildx
cat .checksums/webapps.txt
cat versions/webapps.txt
- uses: actions/cache@v2
with:
path: /tmp/buildx
key: "${{ runner.os }}-buildx-php-${{ matrix.version }}-${{ matrix.app }}-\
${{ hashFiles('.checksums/webapps.txt') }}"
${{ hashFiles('versions/webapps.txt') }}"
restore-keys: "${{ runner.os }}-buildx-php-${{ matrix.version }}-"
- uses: docker/login-action@v1
with:
Expand All @@ -270,9 +270,9 @@ jobs:
cache-from: type=local,src=/tmp/buildx
cache-to: type=local,dest=/tmp/buildx-new,mode=max
context: "{{defaultContext}}:src/webapps/${{ matrix.app }}/"
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
build-args: |
BUILD_NUMBER=${{ steps.config.outputs.date }}-${{ hashFiles('.checksums/webapps.txt') }}
BUILD_NUMBER=${{ steps.config.outputs.date }}-${{ hashFiles('versions/webapps.txt') }}
BASE_IMAGE=shinsenter/php
PHP_VERSION=${{ matrix.version }}
tags: |
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.DS_Store
.checksums
*.log
tests/data/
tests/data/
versions/
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,47 +171,47 @@ ENV PHP_PM_CONTROL="ondemand"

# The number of child processes to be created when pm is set to static
# and the maximum number of child processes to be created when pm is set to dynamic
ENV PHP_PM_MAX_CHILDREN="20"
ENV PHP_PM_MAX_CHILDREN="28"

# The desired maximum number of idle server processes
ENV PHP_PM_MAX_SPARE_SERVERS="3"
ENV PHP_PM_MAX_SPARE_SERVERS="21"

# The desired minimum number of idle server processes
ENV PHP_PM_MIN_SPARE_SERVERS="1"
ENV PHP_PM_MIN_SPARE_SERVERS="7"

# The number of child processes created on startup
ENV PHP_PM_START_SERVERS="2"
ENV PHP_PM_START_SERVERS="7"

################################################################################

# The amount of memory used to store interned strings, in megabytes.
ENV PHP_OPCACHE_INTERNED_STRINGS_BUFFER=8
ENV PHP_OPCACHE_INTERNED_STRINGS_BUFFER="8"

# The maximum number of keys (and therefore scripts) in the OPcache hash table
ENV PHP_OPCACHE_MAX_ACCELERATED_FILES=1048793
ENV PHP_OPCACHE_MAX_ACCELERATED_FILES="1048793"

# The size of the shared memory storage used by OPcache, in megabytes
ENV PHP_OPCACHE_MEMORY_CONSUMPTION=128
ENV PHP_OPCACHE_MEMORY_CONSUMPTION="128"

# This directive facilitates to let the preloading to be run as another user
ENV PHP_OPCACHE_PRELOAD_USER=webuser
ENV PHP_OPCACHE_PRELOAD_USER="webuser"

# Specifies a PHP script that is going to be compiled and executed at server start-up
# Specifies a PHP script that is going to be compiled and executed at start-up
ENV PHP_OPCACHE_PRELOAD=

# How often to check script timestamps for updates, in seconds
ENV PHP_OPCACHE_REVALIDATE_FREQ=2
ENV PHP_OPCACHE_REVALIDATE_FREQ="2"

# If disabled, existing cached files using the same include_path will be reused
ENV PHP_OPCACHE_REVALIDATE_PATH=0
ENV PHP_OPCACHE_REVALIDATE_PATH="0"

# If disabled, all documentation comments will be discarded
# from the opcode cache to reduce the size of the optimised code
ENV PHP_OPCACHE_SAVE_COMMENTS=1
ENV PHP_OPCACHE_SAVE_COMMENTS="1"

# If enabled, OPcache will check for updated scripts
# every opcache.revalidate_freq seconds
ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS=1
ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="1"

################################################################################

Expand Down
1 change: 1 addition & 0 deletions S6_VERSION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v3.1.0.1
43 changes: 43 additions & 0 deletions checksum.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/sh

BASE_DIR="$(git rev-parse --show-toplevel)"
HASH_DIR="$BASE_DIR/versions"

curlhash () {
local output
local url

output=${HASH_DIR}/${1:-checksums.txt}
url=$2

echo "$(curl -sL "$url" | shasum | cut -c1-40) - $url" >$output
}

treehash() {
local output
local location

output=${HASH_DIR}/${1:-checksums.txt};shift
location=$@

rm -f $output && touch $output
for path in $location; do
if [ -f ${HASH_DIR}/$path ]; then
cat ${HASH_DIR}/$path >>$output
else
echo "$(git rev-parse HEAD:$path 2>/dev/null| cut -c1-40) - $path" >>$output
fi
done
}

mkdir -p $HASH_DIR

curlhash .dep-ondrej-php.txt 'http://ppa.launchpad.net/ondrej/php/ubuntu/dists/?C=M;O=D'
curlhash .dep-ondrej-apache.txt 'http://ppa.launchpadcontent.net/ondrej/apache2/ubuntu/dists/?C=M;O=D'
curlhash .dep-ondrej-nginx.txt 'http://ppa.launchpadcontent.net/ondrej/nginx-mainline/ubuntu/dists/?C=M;O=D'

treehash base.txt S6_VERSION.txt src/base/
treehash cli.txt base.txt .dep-ondrej-php.txt src/php/cli/
treehash fpm.txt cli.txt src/php/fpm/
treehash servers.txt fpm.txt .dep-ondrej-apache.txt .dep-ondrej-nginx.txt src/servers/
treehash webapps.txt servers.txt src/webapps/
5 changes: 2 additions & 3 deletions src/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ RUN SYS_ARCH=$(uname -m); \
echo " ⏬ Downloading $1"; \
wget -O- $1 | tar Jxp -C ${2:-"$S6_DIR"}; \
} \
&& S6_SRC_URL=${S6_SRC_URL}/v${S6_VERSION} \
&& untar ${S6_SRC_URL}/s6-overlay-noarch-${S6_VERSION}.tar.xz \
&& untar ${S6_SRC_URL}/s6-overlay-${S6_ARCH}-${S6_VERSION}.tar.xz \
&& untar ${S6_SRC_URL}/${S6_VERSION}/s6-overlay-noarch.tar.xz \
&& untar ${S6_SRC_URL}/${S6_VERSION}/s6-overlay-${S6_ARCH}.tar.xz \
&& du -sh $S6_DIR

################################################################################
Expand Down
12 changes: 0 additions & 12 deletions src/php/cli/root/etc/cont-init.d/500-composer-install

This file was deleted.

12 changes: 7 additions & 5 deletions src/php/fpm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,17 @@ ENV PHP_DISPLAY_ERRORS=On
ENV PHP_ERROR_REPORTING="E_ALL & ~E_DEPRECATED & ~E_STRICT"
ENV PHP_MAX_EXECUTION_TIME=99
ENV PHP_MEMORY_LIMIT=256M
ENV PHP_PM_CONTROL=ondemand
ENV PHP_PM_MAX_CHILDREN=20
ENV PHP_PM_MAX_SPARE_SERVERS=3
ENV PHP_PM_MIN_SPARE_SERVERS=1
ENV PHP_PM_START_SERVERS=2
ENV PHP_POST_MAX_SIZE=100M
ENV PHP_UPLOAD_MAX_FILE_SIZE=100M
ENV PHPFPM_CONF_DIR=/etc/php/fpm/conf.d

# adds PHP PM settings
ENV PHP_PM_CONTROL=ondemand
ENV PHP_PM_MAX_CHILDREN=28
ENV PHP_PM_MAX_SPARE_SERVERS=21
ENV PHP_PM_MIN_SPARE_SERVERS=7
ENV PHP_PM_START_SERVERS=7

# adds other Opcache settings
ENV PHP_OPCACHE_INTERNED_STRINGS_BUFFER=8
ENV PHP_OPCACHE_MAX_ACCELERATED_FILES=1048793
Expand Down
Loading