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
69 changes: 48 additions & 21 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ concurrency:

jobs:
build:
name: Build ${{ matrix.php_version }}-composer${{ matrix.composer_version }}
name: Build ${{ matrix.php_version }}-composer${{ matrix.composer_version }}-${{ matrix.server }}
runs-on: ubuntu-latest
strategy:
matrix:
server: ["fpm", "rr"]
php_version: ["8.1", "8.2", "8.3", "8.4", "8.5"]
composer_version: ["2"]
platforms: ["linux/amd64,linux/arm64/v8"]
Expand All @@ -33,12 +34,18 @@ jobs:
ghcr.io/clevyr/php
flavor: latest=false
tags: |
# {{major}}.{{minor}}-composer{{major}}-base
type=semver,pattern={{major}}.{{minor}},suffix=-composer${{ matrix.composer_version }}-base,value=${{ matrix.php_version }}.0
# {{major}}.{{minor}}-base
type=semver,enable=${{ matrix.composer_version == '2' }},pattern={{major}}.{{minor}},suffix=-base,value=${{ matrix.php_version }}.0
# {{major}}-base
type=semver,enable=${{ matrix.composer_version == '2' && (matrix.latest_major == 'true' || matrix.latest == 'true') }},pattern={{major}},suffix=-base,value=${{ matrix.php_version }}.0
# {{major}}.{{minor}}-composer{{major}}-{{server}}-base
type=semver,pattern={{major}}.{{minor}},suffix=-composer${{ matrix.composer_version }}-${{ matrix.server }}-base,value=${{ matrix.php_version }}.0
# {{major}}.{{minor}}-{{server}}-base
type=semver,enable=${{ matrix.composer_version == '2' }},pattern={{major}}.{{minor}},suffix=-${{ matrix.server }}-base,value=${{ matrix.php_version }}.0
# {{major}}-{{server}}-base
type=semver,enable=${{ matrix.composer_version == '2' && (matrix.latest_major == 'true' || matrix.latest == 'true') }},pattern={{major}},suffix=-${{ matrix.server }}-base,value=${{ matrix.php_version }}.0
# {{major}}.{{minor}}-composer{{major}}-base (FPM only)
type=semver,enable=${{ matrix.composer_version == '2' && matrix.server == 'fpm' }},pattern={{major}}.{{minor}},suffix=-composer${{ matrix.composer_version }}-base,value=${{ matrix.php_version }}.0
# {{major}}.{{minor}}-base (FPM only)
type=semver,enable=${{ matrix.composer_version == '2' && matrix.server == 'fpm' }},pattern={{major}}.{{minor}},suffix=-base,value=${{ matrix.php_version }}.0
# {{major}}-base (FPM only)
type=semver,enable=${{ matrix.composer_version == '2' && matrix.server == 'fpm' && (matrix.latest_major == 'true' || matrix.latest == 'true') }},pattern={{major}},suffix=-base,value=${{ matrix.php_version }}.0

- name: Docker meta (onbuild)
id: meta-onbuild
Expand All @@ -49,22 +56,34 @@ jobs:
ghcr.io/clevyr/php
flavor: latest=false
tags: |
# latest
type=raw,enable=${{ matrix.latest == 'true' }},value=latest
# {{major}}.{{minor}}-composer{{major}}-onbuild
type=semver,pattern={{major}}.{{minor}},suffix=-composer${{ matrix.composer_version }}-onbuild,value=${{ matrix.php_version }}.0
# {{major}}.{{minor}}-composer{{major}}
type=semver,pattern={{major}}.{{minor}},suffix=-composer${{ matrix.composer_version }},value=${{ matrix.php_version }}.0
# {{major}}.{{minor}}-onbuild
type=semver,enable=${{ matrix.composer_version == '2' }},pattern={{major}}.{{minor}},suffix=-onbuild,value=${{ matrix.php_version }}.0
# {{major}}.{{minor}}
type=semver,enable=${{ matrix.composer_version == '2' }},pattern={{major}}.{{minor}},value=${{ matrix.php_version }}.0
# {{major}}-composer{{major}}
type=semver,enable=${{ (matrix.latest_major == 'true' || matrix.latest == 'true') }},pattern={{major}},suffix=-composer${{ matrix.composer_version }},value=${{ matrix.php_version }}.0
# {{major}}-onbuild
type=semver,enable=${{ matrix.composer_version == '2' && (matrix.latest_major == 'true' || matrix.latest == 'true') }},pattern={{major}},suffix=-onbuild,value=${{ matrix.php_version }}.0
# latest (FPM only)
type=raw,enable=${{ matrix.latest == 'true' && matrix.server == 'fpm' }},value=latest
# {{major}}.{{minor}}-composer{{major}}-{{server}}-onbuild
type=semver,pattern={{major}}.{{minor}},suffix=-composer${{ matrix.composer_version }}-${{ matrix.server }}-onbuild,value=${{ matrix.php_version }}.0
# {{major}}.{{minor}}-composer{{major}}-{{server}}
type=semver,pattern={{major}}.{{minor}},suffix=-composer${{ matrix.composer_version }}-${{ matrix.server }},value=${{ matrix.php_version }}.0
# {{major}}.{{minor}}-{{server}}-onbuild
type=semver,enable=${{ matrix.composer_version == '2' }},pattern={{major}}.{{minor}},suffix=-${{ matrix.server }}-onbuild,value=${{ matrix.php_version }}.0
# {{major}}.{{minor}}-{{server}}
type=semver,enable=${{ matrix.composer_version == '2' }},pattern={{major}}.{{minor}},suffix=-${{ matrix.server }},value=${{ matrix.php_version }}.0
# {{major}}-composer{{major}}-{{server}}
type=semver,enable=${{ (matrix.latest_major == 'true' || matrix.latest == 'true') }},pattern={{major}},suffix=-composer${{ matrix.composer_version }}-${{ matrix.server }},value=${{ matrix.php_version }}.0
# {{major}}-{{server}}-onbuild
type=semver,enable=${{ matrix.composer_version == '2' && (matrix.latest_major == 'true' || matrix.latest == 'true') }},pattern={{major}},suffix=-${{ matrix.server }}-onbuild,value=${{ matrix.php_version }}.0
# {{major}}
type=semver,enable=${{ matrix.composer_version == '2' && (matrix.latest_major == 'true' || matrix.latest == 'true') }},pattern={{major}},value=${{ matrix.php_version }}.0
# {{major}}.{{minor}}-composer{{major}}-onbuild (FPM only)
type=semver,enable=${{ matrix.composer_version == '2' && matrix.server == 'fpm' }},pattern={{major}}.{{minor}},suffix=-composer${{ matrix.composer_version }}-onbuild,value=${{ matrix.php_version }}.0
# {{major}}.{{minor}}-composer{{major}} (FPM only)
type=semver,enable=${{ matrix.composer_version == '2' && matrix.server == 'fpm' }},pattern={{major}}.{{minor}},suffix=-composer${{ matrix.composer_version }},value=${{ matrix.php_version }}.0
# {{major}}.{{minor}}-onbuild (FPM only)
type=semver,enable=${{ matrix.composer_version == '2' && matrix.server == 'fpm' }},pattern={{major}}.{{minor}},suffix=-onbuild,value=${{ matrix.php_version }}.0
# {{major}}.{{minor}} (FPM only)
type=semver,enable=${{ matrix.composer_version == '2' && matrix.server == 'fpm' }},pattern={{major}}.{{minor}},value=${{ matrix.php_version }}.0
# {{major}}-composer{{major}} (FPM only)
type=semver,enable=${{ matrix.composer_version == '2' && matrix.server == 'fpm' && (matrix.latest_major == 'true' || matrix.latest == 'true') }},pattern={{major}},suffix=-composer${{ matrix.composer_version }},value=${{ matrix.php_version }}.0
# {{major}} (FPM only)
type=semver,enable=${{ matrix.composer_version == '2' && matrix.server == 'fpm' && (matrix.latest_major == 'true' || matrix.latest == 'true') }},pattern={{major}},value=${{ matrix.php_version }}.0

- name: Set up QEMU
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
Expand All @@ -91,6 +110,7 @@ jobs:
context: .
pull: true
load: true
file: Dockerfile.${{ matrix.server }}
tags: ${{ env.TEST_TAG }}
build-args: |
COMPOSER_VERSION=${{ matrix.composer_version }}
Expand All @@ -99,9 +119,14 @@ jobs:
cache-to: type=gha,mode=max

- name: Test nginx config
if: matrix.server == 'fpm'
run: docker run --rm -i "$TEST_TAG" nginx -t
- name: Test php-fpm config
if: matrix.server == 'fpm'
run: docker run --rm -i "$TEST_TAG" php-fpm -tt
- name: Test RoadRunner
if: matrix.server == 'rr'
run: docker run --rm -i "$TEST_TAG" rr --version
- name: Test commands exist
run: docker run --rm -i "$TEST_TAG" which composer install-php-extensions clevyr-build

Expand All @@ -111,6 +136,7 @@ jobs:
context: .
pull: true
push: ${{ github.ref_name == 'main' }}
file: Dockerfile.${{ matrix.server }}
platforms: ${{ matrix.platforms }}
tags: ${{ steps.meta-base.outputs.tags }}
labels: ${{ steps.meta-base.outputs.labels }}
Expand All @@ -126,6 +152,7 @@ jobs:
with:
context: .
push: ${{ github.ref_name == 'main' }}
file: Dockerfile.${{ matrix.server }}
platforms: ${{ matrix.platforms }}
tags: ${{ steps.meta-onbuild.outputs.tags }}
labels: ${{ steps.meta-onbuild.outputs.labels }}
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile → Dockerfile.fpm
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
ARG COMPOSER_VERSION
ARG ALPINE_VERSION

FROM composer:$COMPOSER_VERSION AS local-composer

Check warning on line 7 in Dockerfile.fpm

View workflow job for this annotation

GitHub Actions / Build 8.5-composer2-fpm

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG composer:$COMPOSER_VERSION results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

Check warning on line 7 in Dockerfile.fpm

View workflow job for this annotation

GitHub Actions / Build 8.5-composer2-fpm

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG composer:$COMPOSER_VERSION results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

Check warning on line 7 in Dockerfile.fpm

View workflow job for this annotation

GitHub Actions / Build 8.5-composer2-fpm

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG composer:$COMPOSER_VERSION results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

FROM php:$PHP_VERSION-fpm-alpine$ALPINE_VERSION AS base

Check warning on line 9 in Dockerfile.fpm

View workflow job for this annotation

GitHub Actions / Build 8.5-composer2-fpm

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG php:$PHP_VERSION-fpm-alpine$ALPINE_VERSION results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

Check warning on line 9 in Dockerfile.fpm

View workflow job for this annotation

GitHub Actions / Build 8.5-composer2-fpm

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG php:$PHP_VERSION-fpm-alpine$ALPINE_VERSION results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/

Check warning on line 9 in Dockerfile.fpm

View workflow job for this annotation

GitHub Actions / Build 8.5-composer2-fpm

Default value for global ARG results in an empty or invalid base image name

InvalidDefaultArgInFrom: Default value for ARG php:$PHP_VERSION-fpm-alpine$ALPINE_VERSION results in empty or invalid base image name More info: https://docs.docker.com/go/dockerfile/rule/invalid-default-arg-in-from/
WORKDIR /app

COPY --from=mlocati/php-extension-installer:2.10.6 /usr/bin/install-php-extensions /usr/bin/
Expand Down Expand Up @@ -86,8 +86,8 @@
fi
EOT

COPY --from=ghcr.io/roadrunner-server/roadrunner:2025.1.11 /usr/bin/rr /usr/local/bin/rr
COPY rootfs/ /
COPY rootfs.common/ /
COPY rootfs.fpm/ /

CMD ["s6-svscan", "/etc/services.d"]

Expand Down
104 changes: 104 additions & 0 deletions Dockerfile.rr
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#syntax=docker/dockerfile:1

ARG PHP_VERSION
ARG COMPOSER_VERSION
ARG ALPINE_VERSION

FROM composer:$COMPOSER_VERSION AS local-composer

FROM php:$PHP_VERSION-cli-alpine$ALPINE_VERSION AS base

COPY --from=mlocati/php-extension-installer:2.10.6 /usr/bin/install-php-extensions /usr/bin/

RUN <<EOT
set -eux
apk add --no-cache bash git jq postgresql-client
install-php-extensions bcmath calendar exif intl pcntl opcache pgsql pdo_pgsql redis sockets zip
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

laravel/octane needs spiral/roadrunner-cli and spiral/roadrunner-http which one or both depend on ext-sockets

cd "$PHP_INI_DIR"
sed -ri \
-e 's/^;?(max_execution_time).*/\1 = ${PHP_MAX_EXECUTION_TIME}/' \
-e 's/^;?(max_input_vars).*/\1 = ${PHP_MAX_INPUT_VARS}/' \
-e 's/^;?(memory_limit).*/\1 = ${PHP_MEMORY_LIMIT}/' \
-e 's/^;?(post_max_size).*/\1 = ${PHP_POST_MAX_SIZE}/' \
-e 's/^;?(upload_max_filesize).*/\1 = ${PHP_UPLOAD_MAX_FILESIZE}/' \
-e 's/^;?(max_file_uploads).*/\1 = ${PHP_MAX_FILE_UPLOADS}/' \
-e 's/^;?(expose_php).*/\1 = Off/' \
php.ini-production
ln -s php.ini-production php.ini
EOT

ENV LC_ALL=C

ARG PHP_MAX_EXECUTION_TIME=30
ENV PHP_MAX_EXECUTION_TIME=$PHP_MAX_EXECUTION_TIME
ARG PHP_MAX_INPUT_VARS=1000
ENV PHP_MAX_INPUT_VARS=$PHP_MAX_INPUT_VARS
ARG PHP_MEMORY_LIMIT=256M
ENV PHP_MEMORY_LIMIT=$PHP_MEMORY_LIMIT
ARG PHP_POST_MAX_SIZE=32M
ENV PHP_POST_MAX_SIZE=$PHP_POST_MAX_SIZE
ARG PHP_UPLOAD_MAX_FILESIZE=8M
ENV PHP_UPLOAD_MAX_FILESIZE=$PHP_UPLOAD_MAX_FILESIZE
ARG PHP_MAX_FILE_UPLOADS=20
ENV PHP_MAX_FILE_UPLOADS=$PHP_MAX_FILE_UPLOADS

ARG COMPOSER_MEMORY_LIMIT=-1
ENV COMPOSER_MEMORY_LIMIT=$COMPOSER_MEMORY_LIMIT

ARG COMPOSER_VERSION
COPY --from=local-composer /usr/bin/composer /usr/bin/composer
RUN <<EOT
set -eux
if [ "$COMPOSER_VERSION" = "1" ]; then
composer global require hirak/prestissimo
composer clear-cache
fi
EOT

COPY --from=ghcr.io/roadrunner-server/roadrunner:2025.1.11 /usr/bin/rr /usr/local/bin/rr
COPY rootfs.common/ /
COPY rootfs.rr/ /

USER nobody:nogroup
WORKDIR /app

FROM base AS onbuild

ONBUILD ARG PHP_MAX_EXECUTION_TIME
ONBUILD ENV PHP_MAX_EXECUTION_TIME=${PHP_MAX_EXECUTION_TIME:-30}
ONBUILD ARG PHP_MAX_INPUT_VARS
ONBUILD ENV PHP_MAX_INPUT_VARS=${PHP_MAX_INPUT_VARS:-1000}
ONBUILD ARG PHP_MEMORY_LIMIT
ONBUILD ENV PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT:-256M}
ONBUILD ARG PHP_POST_MAX_SIZE
ONBUILD ENV PHP_POST_MAX_SIZE=${PHP_POST_MAX_SIZE:-32M}
ONBUILD ARG PHP_UPLOAD_MAX_FILESIZE
ONBUILD ENV PHP_UPLOAD_MAX_FILESIZE=${PHP_UPLOAD_MAX_FILESIZE:-8M}
ONBUILD ARG PHP_MAX_FILE_UPLOADS
ONBUILD ENV PHP_MAX_FILE_UPLOADS=${PHP_MAX_FILE_UPLOADS:-20}

ONBUILD ARG SKIP_BUILD
ONBUILD ARG DEPS
ONBUILD ARG INSTALL

ONBUILD ARG INSTALL_GD
ONBUILD ARG INSTALL_IMAGICK
ONBUILD ARG INSTALL_MOSQUITTO
ONBUILD ARG INSTALL_MYSQL
ONBUILD ARG INSTALL_SQLSRV
ONBUILD ARG INSTALL_XDEBUG

ONBUILD ARG COMPOSER_VERSION

ONBUILD ARG IPE_GD_WITHOUTAVIF=1

ONBUILD USER root

ONBUILD RUN <<EOT
set -eux
if [ "${SKIP_BUILD:-}" != "true" ]; then
clevyr-build
fi
EOT

ONBUILD USER nobody:nogroup
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,29 @@

[![Docker Build](https://github.com/clevyr/docker-php/actions/workflows/docker.yml/badge.svg)](https://github.com/clevyr/docker-php/actions/workflows/docker.yml)

An enhanced version of the default [PHP Docker image](https://hub.docker.com/_/php) which can install PHP extensions without requiring manual dependency installation using [mlocati/docker-php-extension-installer](https://github.com/mlocati/docker-php-extension-installer) and installs a default nginx setup.
An enhanced version of the default [PHP Docker image](https://hub.docker.com/_/php) which can install PHP extensions without requiring manual dependency installation using [mlocati/docker-php-extension-installer](https://github.com/mlocati/docker-php-extension-installer).

## Image Variants

Two image variants are available, distinguished by tag suffix:

| Tag Suffix | Description | Example |
|------------|--------------------------------------------------------------|-----------|
| `-fpm` | PHP-FPM with Nginx, managed by s6 | `8.5-fpm` |
| `-rr` | PHP CLI with [RoadRunner](https://roadrunner.dev) (rootless) | `8.5-rr` |

Tags without a suffix (e.g. `8.5`) default to the `-fpm` variant for backward compatibility.

## Pull Command

The following command will retrieve an image with PHP 8.5 and Composer v2:

```sh
docker pull ghcr.io/clevyr/php:8.5
# PHP-FPM + Nginx
docker pull ghcr.io/clevyr/php:8.5-fpm

# RoadRunner
docker pull ghcr.io/clevyr/php:8.5-rr
```

## Runtime Configuration
Expand All @@ -29,7 +44,7 @@ Some php.ini values can be configured as a build arg.
| `PHP_UPLOAD_MAX_FILESIZE` | See [`upload_max_filesize`](https://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize). | `8M` |
| `PHP_MAX_FILE_UPLOADS` | See [`max_file_uploads`](https://www.php.net/manual/en/ini.core.php#ini.max-file-uploads). | `20` |

### PHP-FPM Configuration
### PHP-FPM Configuration (`-fpm` only)

| Environment Variable | Description | Default |
|--------------------------------|-----------------------------------------------------------------------------------------------------------------|---------|
Expand All @@ -48,7 +63,7 @@ The following variables can be only be configured at build.
| `INSTALL` | PHP extensions to install. See [here](https://github.com/mlocati/docker-php-extension-installer#supported-php-extensions) for available extensions. |
| `DEPS` | `apk` dependencies to install during the build. |

### Nginx Configuration
### Nginx Configuration (`-fpm` only)

Some nginx values can be configured as a build arg.

Expand Down
30 changes: 16 additions & 14 deletions rootfs/usr/bin/clevyr-build → rootfs.common/usr/bin/clevyr-build
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
#!/bin/bash

set -ef
set -efuo pipefail

log() {
printf '%s: %s\n' "$(basename "$0")" "$@" >&2
}

if [ "$INSTALL_MYSQL" = "true" ]; then
if [ "${INSTALL_MYSQL:-}" = "true" ]; then
unset INSTALL_MYSQL
export INSTALL="$INSTALL mysqli pdo_mysql"
export INSTALL="${INSTALL:-} mysqli pdo_mysql"
fi

if [ "$INSTALL_SQLSRV" = "true" ]; then
if [ "${INSTALL_SQLSRV:-}" = "true" ]; then
unset INSTALL_SQLSRV
export INSTALL="$INSTALL sqlsrv pdo_sqlsrv"
export INSTALL="${INSTALL:-} sqlsrv pdo_sqlsrv"
fi

# Add workaround for xdebug alpha release
if [ "$INSTALL_XDEBUG" == "true" ]; then
if [ "${INSTALL_XDEBUG:-}" = "true" ]; then
unset INSTALL_XDEBUG
export INSTALL="$INSTALL xdebug-stable"
export INSTALL="${INSTALL:-} xdebug-stable"
fi

# Add old dependency args to new variable

INSTALL=( $INSTALL "$@" )
INSTALL=( ${INSTALL:-} "$@" )
INSTALL+=( $(env | grep '^INSTALL_.*=true$' | cut -d= -f1 | cut -d_ -f2- | tr '[:upper:]' '[:lower:]' | tr '_' '-') )

DEPS=( $DEPS )
UNTRUSTED_DEPS=( $UNTRUSTED_DEPS )
DEPS=( ${DEPS:-} )
UNTRUSTED_DEPS=( ${UNTRUSTED_DEPS:-} )

# Check for dependencies
export BUILD_TMP='/tmp/clevyr-build'
Expand Down Expand Up @@ -62,10 +62,12 @@ log "Beginning install: ${INSTALL[*]}"
install-php-extensions "${INSTALL[@]}"

# Template nginx config
log 'Templating nginx config'
export NGINX_ROOT="${NGINX_ROOT:-/app/public}" \
NGINX_EXPIRES="${NGINX_EXPIRES:-7d}"
envsubst '$NGINX_ROOT $NGINX_EXPIRES' < /etc/nginx/conf.d/default.conf.tpl > /etc/nginx/conf.d/default.conf
if [[ -f /etc/nginx/conf.d/default.conf.tpl ]]; then
log 'Templating nginx config'
export NGINX_ROOT="${NGINX_ROOT:-/app/public}" \
NGINX_EXPIRES="${NGINX_EXPIRES:-7d}"
envsubst '$NGINX_ROOT $NGINX_EXPIRES' < /etc/nginx/conf.d/default.conf.tpl > /etc/nginx/conf.d/default.conf
fi

log 'Removing all tmp files'
rm -rf /tmp/*
2 changes: 1 addition & 1 deletion rootfs/entrypoint → rootfs.fpm/entrypoint
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

set -e
set -efu

cd /app
exec php-fpm
File renamed without changes.
14 changes: 14 additions & 0 deletions rootfs.fpm/health-check
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

set -efu

HEALTH_CHECK_IP="${1:-127.0.0.1}"
HEALTH_CHECK_PORT="${2:-9000}"

env -i REDIRECT_STATUS=true \
SCRIPT_NAME=/ping \
SCRIPT_FILENAME=/ping \
REQUEST_METHOD=GET \
cgi-fcgi -bind -connect \
"${HEALTH_CHECK_IP}:${HEALTH_CHECK_PORT}" \
| grep -e pong >/dev/null
File renamed without changes.
8 changes: 8 additions & 0 deletions rootfs.rr/health-check
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

set -efu

HEALTH_CHECK_HOST="${1:-127.0.0.1}"
HEALTH_CHECK_PORT="${2:-2114}"

wget -qO /dev/null "http://${HEALTH_CHECK_HOST}:${HEALTH_CHECK_PORT}/health?plugin=http"
Loading