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
35 changes: 24 additions & 11 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
name: CI/CD

on: [pull_request, push, workflow_dispatch]
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
repository_dispatch:
types: [docker-php-swoole-updated]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

env:
DOCKER_BUILDKIT: 1
Expand All @@ -10,13 +23,17 @@ jobs:
name: Build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
version: ['8.2', '8.3', '8.4']

steps:
- name: Checkout code
uses: actions/checkout@v3.3.0

- name: Check generated Dockerfiles
run: python3 tests/check-generated.py

- name: Build
run: |
docker build --pull -t kooldev/php:${{ matrix.version }}-oci8-nginx ${{ matrix.version }}-oci8-nginx
Expand All @@ -27,24 +44,20 @@ jobs:

- name: Tests
run: |
docker run kooldev/php:${{ matrix.version }}-oci8-nginx php -r "extension_loaded('oci8') or die(1);"
docker run kooldev/php:${{ matrix.version }}-oci8-nginx-prod php -r "extension_loaded('oci8') or die(1);"

docker run kooldev/php:${{ matrix.version }}-oci8-nginx php -r "extension_loaded('oci8') or die(1);"
docker run kooldev/php:${{ matrix.version }}-oci8-nginx-prod php -r "extension_loaded('oci8') or die(1);"

docker run kooldev/php:${{ matrix.version }}-oci8-swoole-nginx php -r "extension_loaded('oci8') or die(1);"
docker run kooldev/php:${{ matrix.version }}-oci8-swoole-nginx-prod php -r "extension_loaded('oci8') or die(1);"
for variant in nginx nginx-prod swoole-nginx swoole-nginx-prod; do
image="${{ matrix.version }}-oci8-${variant}"
bash tests/test-image.sh "kooldev/php:${image}" "${image}/Dockerfile"
done

- name: Login to DockerHub
uses: docker/login-action@v2.1.0
if: github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-php-oci8'
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-php-oci8'
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push to DockerHub
if: github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-php-oci8'
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.repository == 'kool-dev/docker-php-oci8'
run: |
docker push kooldev/php:${{ matrix.version }}-oci8-nginx
docker push kooldev/php:${{ matrix.version }}-oci8-nginx-prod
Expand Down
7 changes: 4 additions & 3 deletions 8.2-oci8-nginx-prod/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ENV LD_LIBRARY_PATH /usr/local/instantclient
ENV ORACLE_HOME /usr/local/instantclient

# Download and unarchive Instant Client v11
RUN apk add --update libaio libnsl && \
RUN apk add --update libaio libnsl $PHPIZE_DEPS && \
curl -o /tmp/instaclient-basic.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-basic-linux.x64-11.2.0.4.0.zip && \
curl -o /tmp/instaclient-sdk.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-sdk-linux.x64-11.2.0.4.0.zip && \
curl -o /tmp/instaclient-sqlplus.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-sqlplus-linux.x64-11.2.0.4.0.zip && \
Expand All @@ -17,5 +17,6 @@ RUN apk add --update libaio libnsl && \
ln -s ${ORACLE_HOME}/lib* /usr/lib && \
ln -s ${ORACLE_HOME}/sqlplus /usr/bin/sqlplus && \
ln -s /usr/lib/libnsl.so.3 /usr/lib/libnsl.so.1 && \
docker-php-ext-configure oci8 --with-oci8=instantclient,$ORACLE_HOME && \
docker-php-ext-install oci8
echo "instantclient,${ORACLE_HOME}" | pecl install oci8 && \
docker-php-ext-enable oci8 && \
apk del $PHPIZE_DEPS
7 changes: 4 additions & 3 deletions 8.2-oci8-nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ENV LD_LIBRARY_PATH /usr/local/instantclient
ENV ORACLE_HOME /usr/local/instantclient

# Download and unarchive Instant Client v11
RUN apk add --update libaio libnsl && \
RUN apk add --update libaio libnsl $PHPIZE_DEPS && \
curl -o /tmp/instaclient-basic.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-basic-linux.x64-11.2.0.4.0.zip && \
curl -o /tmp/instaclient-sdk.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-sdk-linux.x64-11.2.0.4.0.zip && \
curl -o /tmp/instaclient-sqlplus.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-sqlplus-linux.x64-11.2.0.4.0.zip && \
Expand All @@ -17,5 +17,6 @@ RUN apk add --update libaio libnsl && \
ln -s ${ORACLE_HOME}/lib* /usr/lib && \
ln -s ${ORACLE_HOME}/sqlplus /usr/bin/sqlplus && \
ln -s /usr/lib/libnsl.so.3 /usr/lib/libnsl.so.1 && \
docker-php-ext-configure oci8 --with-oci8=instantclient,$ORACLE_HOME && \
docker-php-ext-install oci8
echo "instantclient,${ORACLE_HOME}" | pecl install oci8 && \
docker-php-ext-enable oci8 && \
apk del $PHPIZE_DEPS
7 changes: 4 additions & 3 deletions 8.2-oci8-swoole-nginx-prod/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ENV LD_LIBRARY_PATH /usr/local/instantclient
ENV ORACLE_HOME /usr/local/instantclient

# Download and unarchive Instant Client v11
RUN apk add --update libaio libnsl && \
RUN apk add --update libaio libnsl $PHPIZE_DEPS && \
curl -o /tmp/instaclient-basic.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-basic-linux.x64-11.2.0.4.0.zip && \
curl -o /tmp/instaclient-sdk.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-sdk-linux.x64-11.2.0.4.0.zip && \
curl -o /tmp/instaclient-sqlplus.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-sqlplus-linux.x64-11.2.0.4.0.zip && \
Expand All @@ -17,5 +17,6 @@ RUN apk add --update libaio libnsl && \
ln -s ${ORACLE_HOME}/lib* /usr/lib && \
ln -s ${ORACLE_HOME}/sqlplus /usr/bin/sqlplus && \
ln -s /usr/lib/libnsl.so.3 /usr/lib/libnsl.so.1 && \
docker-php-ext-configure oci8 --with-oci8=instantclient,$ORACLE_HOME && \
docker-php-ext-install oci8
echo "instantclient,${ORACLE_HOME}" | pecl install oci8 && \
docker-php-ext-enable oci8 && \
apk del $PHPIZE_DEPS
7 changes: 4 additions & 3 deletions 8.2-oci8-swoole-nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ENV LD_LIBRARY_PATH /usr/local/instantclient
ENV ORACLE_HOME /usr/local/instantclient

# Download and unarchive Instant Client v11
RUN apk add --update libaio libnsl && \
RUN apk add --update libaio libnsl $PHPIZE_DEPS && \
curl -o /tmp/instaclient-basic.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-basic-linux.x64-11.2.0.4.0.zip && \
curl -o /tmp/instaclient-sdk.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-sdk-linux.x64-11.2.0.4.0.zip && \
curl -o /tmp/instaclient-sqlplus.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-sqlplus-linux.x64-11.2.0.4.0.zip && \
Expand All @@ -17,5 +17,6 @@ RUN apk add --update libaio libnsl && \
ln -s ${ORACLE_HOME}/lib* /usr/lib && \
ln -s ${ORACLE_HOME}/sqlplus /usr/bin/sqlplus && \
ln -s /usr/lib/libnsl.so.3 /usr/lib/libnsl.so.1 && \
docker-php-ext-configure oci8 --with-oci8=instantclient,$ORACLE_HOME && \
docker-php-ext-install oci8
echo "instantclient,${ORACLE_HOME}" | pecl install oci8 && \
docker-php-ext-enable oci8 && \
apk del $PHPIZE_DEPS
7 changes: 4 additions & 3 deletions 8.3-oci8-nginx-prod/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ENV LD_LIBRARY_PATH /usr/local/instantclient
ENV ORACLE_HOME /usr/local/instantclient

# Download and unarchive Instant Client v11
RUN apk add --update libaio libnsl && \
RUN apk add --update libaio libnsl $PHPIZE_DEPS && \
curl -o /tmp/instaclient-basic.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-basic-linux.x64-11.2.0.4.0.zip && \
curl -o /tmp/instaclient-sdk.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-sdk-linux.x64-11.2.0.4.0.zip && \
curl -o /tmp/instaclient-sqlplus.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-sqlplus-linux.x64-11.2.0.4.0.zip && \
Expand All @@ -17,5 +17,6 @@ RUN apk add --update libaio libnsl && \
ln -s ${ORACLE_HOME}/lib* /usr/lib && \
ln -s ${ORACLE_HOME}/sqlplus /usr/bin/sqlplus && \
ln -s /usr/lib/libnsl.so.3 /usr/lib/libnsl.so.1 && \
docker-php-ext-configure oci8 --with-oci8=instantclient,$ORACLE_HOME && \
docker-php-ext-install oci8
echo "instantclient,${ORACLE_HOME}" | pecl install oci8 && \
docker-php-ext-enable oci8 && \
apk del $PHPIZE_DEPS
7 changes: 4 additions & 3 deletions 8.3-oci8-nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ENV LD_LIBRARY_PATH /usr/local/instantclient
ENV ORACLE_HOME /usr/local/instantclient

# Download and unarchive Instant Client v11
RUN apk add --update libaio libnsl && \
RUN apk add --update libaio libnsl $PHPIZE_DEPS && \
curl -o /tmp/instaclient-basic.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-basic-linux.x64-11.2.0.4.0.zip && \
curl -o /tmp/instaclient-sdk.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-sdk-linux.x64-11.2.0.4.0.zip && \
curl -o /tmp/instaclient-sqlplus.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-sqlplus-linux.x64-11.2.0.4.0.zip && \
Expand All @@ -17,5 +17,6 @@ RUN apk add --update libaio libnsl && \
ln -s ${ORACLE_HOME}/lib* /usr/lib && \
ln -s ${ORACLE_HOME}/sqlplus /usr/bin/sqlplus && \
ln -s /usr/lib/libnsl.so.3 /usr/lib/libnsl.so.1 && \
docker-php-ext-configure oci8 --with-oci8=instantclient,$ORACLE_HOME && \
docker-php-ext-install oci8
echo "instantclient,${ORACLE_HOME}" | pecl install oci8 && \
docker-php-ext-enable oci8 && \
apk del $PHPIZE_DEPS
7 changes: 4 additions & 3 deletions 8.3-oci8-swoole-nginx-prod/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ENV LD_LIBRARY_PATH /usr/local/instantclient
ENV ORACLE_HOME /usr/local/instantclient

# Download and unarchive Instant Client v11
RUN apk add --update libaio libnsl && \
RUN apk add --update libaio libnsl $PHPIZE_DEPS && \
curl -o /tmp/instaclient-basic.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-basic-linux.x64-11.2.0.4.0.zip && \
curl -o /tmp/instaclient-sdk.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-sdk-linux.x64-11.2.0.4.0.zip && \
curl -o /tmp/instaclient-sqlplus.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-sqlplus-linux.x64-11.2.0.4.0.zip && \
Expand All @@ -17,5 +17,6 @@ RUN apk add --update libaio libnsl && \
ln -s ${ORACLE_HOME}/lib* /usr/lib && \
ln -s ${ORACLE_HOME}/sqlplus /usr/bin/sqlplus && \
ln -s /usr/lib/libnsl.so.3 /usr/lib/libnsl.so.1 && \
docker-php-ext-configure oci8 --with-oci8=instantclient,$ORACLE_HOME && \
docker-php-ext-install oci8
echo "instantclient,${ORACLE_HOME}" | pecl install oci8 && \
docker-php-ext-enable oci8 && \
apk del $PHPIZE_DEPS
7 changes: 4 additions & 3 deletions 8.3-oci8-swoole-nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ENV LD_LIBRARY_PATH /usr/local/instantclient
ENV ORACLE_HOME /usr/local/instantclient

# Download and unarchive Instant Client v11
RUN apk add --update libaio libnsl && \
RUN apk add --update libaio libnsl $PHPIZE_DEPS && \
curl -o /tmp/instaclient-basic.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-basic-linux.x64-11.2.0.4.0.zip && \
curl -o /tmp/instaclient-sdk.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-sdk-linux.x64-11.2.0.4.0.zip && \
curl -o /tmp/instaclient-sqlplus.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-sqlplus-linux.x64-11.2.0.4.0.zip && \
Expand All @@ -17,5 +17,6 @@ RUN apk add --update libaio libnsl && \
ln -s ${ORACLE_HOME}/lib* /usr/lib && \
ln -s ${ORACLE_HOME}/sqlplus /usr/bin/sqlplus && \
ln -s /usr/lib/libnsl.so.3 /usr/lib/libnsl.so.1 && \
docker-php-ext-configure oci8 --with-oci8=instantclient,$ORACLE_HOME && \
docker-php-ext-install oci8
echo "instantclient,${ORACLE_HOME}" | pecl install oci8 && \
docker-php-ext-enable oci8 && \
apk del $PHPIZE_DEPS
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,42 @@ After any changes, we need to run `kool run template` to parse the templates and
## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

## Rebuilds and validation

CI rebuilds on `docker-php-swoole-updated` repository dispatches, using
`docker build --pull` to refresh each parent. The event is sent after all Swoole
image publications succeed. Upstream PHP scheduled parent rebuilds propagate
through Swoole to OCI8; there is no direct PHP event receiver or separate OCI8
rebuild cron, avoiding duplicate or premature builds against old Swoole parents.
Workflow runs are serialized by ref. Only superseded PR runs are canceled;
main-branch release runs are allowed to finish. Dispatch delivery requires the
upstream Swoole repository's dispatch credentials and OCI8 recipient
configuration. If delivery fails, recover with this workflow's manual
`workflow_dispatch` on `main` after the required parents have been published.
Only builds on this repository's `main` branch publish images; PRs do not.

To validate a local build:

```sh
python3 tests/check-generated.py
docker build --pull -t oci8-test 8.4-oci8-nginx
bash tests/test-image.sh oci8-test 8.4-oci8-nginx/Dockerfile
```

The smoke test checks PHP against the freshly pulled parent, OCI8, native
Instant Client loading, and the expected Oracle no-listener error from a
loopback connection. It is bounded to 30 seconds. Instant Client 11.2 hangs
in the tested Alpine image with Docker's `--network none`, so this check uses
the normal bridge but connects only to loopback. It does not test
authentication, queries, TLS, SQL*Plus, or a live Oracle database.

These images remain **amd64-only**. The template still downloads legacy Oracle
Instant Client 11.2 x64 ZIPs from a third-party GitHub repository's mutable
`master` branch without checksum verification. Successful loading is not
provenance or security validation. Replacing that source/client and adding ARM
support require separate licensing, provenance, and compatibility review.
Swoole variants depend on the separately published Swoole parents; verify
delivery of the post-publication event through the PHP → Swoole → OCI8 chain.
After merging, maintainers must publish and verify every supported tag's
runtime version and digest before considering stale published images fixed.
1 change: 1 addition & 0 deletions template/Dockerfile.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
ENV LD_LIBRARY_PATH /usr/local/instantclient
ENV ORACLE_HOME /usr/local/instantclient

# Download and unarchive Instant Client v11
RUN apk add --update libaio libnsl $PHPIZE_DEPS && \
curl -o /tmp/instaclient-basic.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-basic-linux.x64-11.2.0.4.0.zip && \
curl -o /tmp/instaclient-sdk.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-sdk-linux.x64-11.2.0.4.0.zip && \
Expand Down
11 changes: 11 additions & 0 deletions tests/check-generated.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import json
from pathlib import Path


template = Path("template/Dockerfile.blade.php").read_text()
for build in json.loads(Path("fwd-template.json").read_text())["builds"]:
expected = template.replace("{{ $from }}", build["data"]["from"])
path = Path(build["name"]) / "Dockerfile"
if path.read_text() != expected:
raise SystemExit(f"{path} differs from its template; run kool run template")
print("Generated Dockerfiles match the template")
23 changes: 23 additions & 0 deletions tests/smoke.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

function check($condition, $message)
{
if (!$condition) {
fwrite(STDERR, $message . "\n");
exit(1);
}
}

check(PHP_VERSION === getenv('EXPECTED_PHP_VERSION'), 'PHP must match the freshly pulled parent');
check(extension_loaded('oci8'), 'oci8 must load');
check(function_exists('oci_connect'), 'OCI connection API must be available');
check(oci_client_version() === '11.2.0.4.0', 'The bundled Instant Client must load');

// Exercise the native client without a database or external network access.
$connection = @oci_connect('invalid', 'invalid', '//127.0.0.1:1/XE');
check($connection === false, 'Connection to an unused loopback port must fail');
$error = oci_error();
check(is_array($error) && $error['code'] === 12541, json_encode($error));

echo 'PHP ', PHP_VERSION, '; OCI8 ', phpversion('oci8'),
'; Instant Client ', oci_client_version(), "; native client smoke checks passed\n";
13 changes: 13 additions & 0 deletions tests/test-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -euo pipefail

image="${1:?image required}"
dockerfile="${2:?Dockerfile required}"
parent="$(awk '$1 == "FROM" { print $2; exit }' "$dockerfile")"
docker pull "$parent"
expected="$(docker run --rm --network none --entrypoint php "$parent" -r 'echo PHP_VERSION;')"

# Instant Client 11.2 hangs on Alpine with Docker's network=none.
# Use the normal bridge, but connect only to the container's loopback address.
docker run --rm -i --entrypoint timeout \
-e EXPECTED_PHP_VERSION="$expected" "$image" 30 php < tests/smoke.php
Loading