Skip to content

Commit 6bf2802

Browse files
authored
Merge pull request #766 from nextcloud/feat/shallow-server-oci
2 parents b1197b9 + ba20897 commit 6bf2802

File tree

4 files changed

+66
-2
lines changed

4 files changed

+66
-2
lines changed

.github/workflows/build-test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ jobs:
5252

5353
- name: Set up QEMU
5454
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
55+
with:
56+
# https://github.com/tonistiigi/binfmt/issues/240
57+
# https://github.com/docker/buildx/issues/1170
58+
image: tonistiigi/binfmt:qemu-v7.0.0-28
5559

5660
- name: Set up Docker Buildx
5761
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0

shallow-server/Dockerfile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,19 @@ RUN apt-get update && \
1313
php-dompdf php8.1-apcu redis-server php8.1-redis php8.1-smbclient \
1414
php8.1-ldap unzip php8.1-pgsql php8.1-sqlite make apache2 \
1515
php8.1-opcache libmagickcore-6.q16-2-extra \
16-
libapache2-mod-php8.1 && \
16+
libapache2-mod-php8.1 php-pear libaio1 build-essential expect && \
1717
apt-get autoremove -y && apt-get autoclean && apt-get clean && \
1818
rm -rf /tmp/* /var/tmp/* /var/lib/apt/lists/*
1919

20-
COPY opcache-recommended.ini /etc/php/8.1/cli/conf.d/99-opcache-recommended.ini
20+
# Oracle setup
21+
COPY oci8-setup.sh /tmp/oci8-setup.sh
22+
RUN chmod +x /tmp/oci8-setup.sh && \
23+
/tmp/oci8-setup.sh && \
24+
rm -f /tmp/oci8-setup.sh
25+
2126
COPY apc-cli-enable.ini /etc/php/8.1/cli/conf.d/99-apc-cli-enable.ini
27+
COPY oci8-enable.ini /etc/php/8.1/apache2/conf.d/99-oci8-enable.ini
28+
COPY opcache-recommended.ini /etc/php/8.1/cli/conf.d/99-opcache-recommended.ini
2229

2330
WORKDIR /var/www/html
2431

shallow-server/oci8-enable.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
extension=oci8.so

shallow-server/oci8-setup.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
# Exit immediately if a command exits with a non-zero status.
4+
set -e
5+
6+
ORACLE_DIR="/opt/oracle/instantclient"
7+
8+
# Remove existing files if they exist
9+
[ -f "instantclient-basic-linuxx64.zip" ] && rm "instantclient-basic-linuxx64.zip"
10+
[ -f "instantclient-sdk-linuxx64.zip" ] && rm "instantclient-sdk-linuxx64.zip"
11+
12+
# Download Oracle Instant Client basic package
13+
curl -kL "https://download.oracle.com/otn_software/linux/instantclient/instantclient-basic-linuxx64.zip" > "instantclient-basic-linuxx64.zip"
14+
15+
# Download Oracle Instant Client SDK package
16+
curl -kL "https://download.oracle.com/otn_software/linux/instantclient/instantclient-sdk-linuxx64.zip" > "instantclient-sdk-linuxx64.zip"
17+
18+
# Unzip the downloaded files
19+
echo "Unzipping downloaded files..."
20+
unzip -o instantclient-basic-linuxx64.zip
21+
unzip -o instantclient-sdk-linuxx64.zip
22+
23+
# Create Oracle directory
24+
echo "Creating Oracle directory..."
25+
mkdir -p $ORACLE_DIR
26+
27+
# Move Instant Client to the Oracle directory
28+
echo "Moving Instant Client to the Oracle directory..."
29+
mv instantclient*/* $ORACLE_DIR
30+
ls -la $ORACLE_DIR
31+
32+
# Create symbolic links
33+
echo "Creating symbolic links..."
34+
ln -sf $ORACLE_DIR/libclntsh.so.12.1 $ORACLE_DIR/libclntsh.so
35+
ln -sf $ORACLE_DIR/libocci.so.12.1 $ORACLE_DIR/libocci.so
36+
37+
# Configure dynamic linker run-time bindings
38+
echo "Configuring dynamic linker run-time bindings..."
39+
echo $ORACLE_DIR | tee /etc/ld.so.conf.d/oracle-instantclient.conf
40+
ldconfig
41+
42+
# Install OCI8 for PHP 8.2
43+
echo "Installing OCI8 extension for PHP 8.2..."
44+
/usr/bin/expect <<EOF
45+
set timeout 60
46+
spawn pecl install oci8-3.2.1
47+
expect "Please provide the path to the ORACLE_HOME directory"
48+
send "instantclient,/opt/oracle/instantclient\r"
49+
expect eof
50+
EOF
51+
52+
echo "Oracle Instant Client and OCI8 installation completed."

0 commit comments

Comments
 (0)