Skip to content

Commit

Permalink
Improve local testing for all RDBMS
Browse files Browse the repository at this point in the history
  • Loading branch information
arogachev committed Oct 18, 2024
1 parent d5e543c commit 8580b8a
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 33 deletions.
48 changes: 48 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
FROM php:8.3-cli

# System packages

RUN apt-get update && apt-get install -y unzip libaio1

# Oracle Instant Client Downloads for Linux x86-64 (64-bit)

RUN cd /tmp && curl -L https://download.oracle.com/otn_software/linux/instantclient/2350000/instantclient-basic-linux.x64-23.5.0.24.07.zip -O
RUN cd /tmp && curl -L https://download.oracle.com/otn_software/linux/instantclient/2350000/instantclient-sdk-linux.x64-23.5.0.24.07.zip -O
RUN cd /tmp && curl -L https://download.oracle.com/otn_software/linux/instantclient/2350000/instantclient-sqlplus-linux.x64-23.5.0.24.07.zip -O

RUN unzip /tmp/instantclient-basic-linux.x64-23.5.0.24.07.zip -d /usr/local/
RUN unzip -o /tmp/instantclient-sdk-linux.x64-23.5.0.24.07.zip -d /usr/local/
RUN unzip -o /tmp/instantclient-sqlplus-linux.x64-23.5.0.24.07.zip -d /usr/local/

RUN ln -s /usr/local/instantclient_23_5 /usr/local/instantclient
# Fixes error "libnnz19.so: cannot open shared object file: No such file or directory"
RUN ln -s /usr/local/instantclient/lib* /usr/lib
RUN ln -s /usr/local/instantclient/sqlplus /usr/bin/sqlplus

RUN echo 'export LD_LIBRARY_PATH="/usr/local/instantclient"' >> /root/.bashrc
RUN echo 'umask 002' >> /root/.bashrc

# PHP extensions

RUN echo 'instantclient,/usr/local/instantclient' | pecl install oci8
RUN echo "extension=oci8.so" > /usr/local/etc/php/conf.d/php-oci8.ini

RUN echo 'instantclient,/usr/local/instantclient' | pecl install pdo_oci
RUN echo "extension=pdo_oci.so" > /usr/local/etc/php/conf.d/php-pdo-oci.ini

# PHP logs

RUN printf "log_errors = On \nerror_log = /dev/stderr\n" > /usr/local/etc/php/conf.d/php-logs.ini

# Composer

COPY --from=composer:2.8.1 /usr/bin/composer /usr/local/bin/composer

# Code

COPY . /code
WORKDIR /code

# PHP packages

RUN composer install
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
"yiisoft/db-pgsql": "^1.3",
"yiisoft/db-sqlite": "^1.2"
},
"provide": {
"ext-pdo_pgsql": "*"
},
"autoload": {
"psr-4": {
"Yiisoft\\Data\\Db\\": "src"
Expand Down
20 changes: 20 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
services:
php:
build: .
volumes:
- ./src:/code/src
- ./tests:/code/tests
- ./phpunit.xml.dist:/code/phpunit.xml.dist
command: tail -F anything

oracle:
image: gvenzl/oracle-xe:21
ports:
- 1521:1521
expose:
- 1521
environment:
ORACLE_PASSWORD : root
ORACLE_DATABASE : yiitest
APP_USER: yiitest
APP_USER_PASSWORD: root
2 changes: 1 addition & 1 deletion tests/.env
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ YII_MSSQL_USER=SA
YII_MSSQL_PASSWORD=SSpaSS__1

YII_ORACLE_DATABASE=
YII_ORACLE_HOST=localhost
YII_ORACLE_HOST=oracle
YII_ORACLE_PORT=
YII_ORACLE_USER=system
YII_ORACLE_PASSWORD=root
32 changes: 0 additions & 32 deletions tests/docker-compose.yml

This file was deleted.

0 comments on commit 8580b8a

Please sign in to comment.