mfvitale / postgres-oracle-fdw

Dockerfile for build a PostgreSQL image with Oracle Foreign Data Wrapper extension
MIT License
16 stars 8 forks source link

Not exactly an issue but I used your work to provide an alternative way of building the container. #1

Open dr-kd opened 2 years ago

dr-kd commented 2 years ago

Thanks for doing this - made some things nice and easy for me. It turns out that orafdw is a better oracle client than sqlplus :).

I did this because I needed some other extensions. It stops having to haul around the instant client binaries in the repo / as a COPY container layer. It's based on your work and can confirm it works. (I also needed pg 15)

ARG postgres_version=15beta4

FROM postgres:$postgres_version

ARG oracle_fdw_version=2_4_0

ENV ORACLE_HOME /usr/lib/oracle/19.6/client64
ENV LD_LIBRARY_PATH /usr/lib/oracle/19.6/client64/lib

RUN set -ex; \
    apt-get update && apt-get install -y --no-install-recommends \
        apt-utils \
        libaio1 \
        libaio-dev \
        build-essential \
        git-core \
        curl \
        less \
        make \
        unzip \
        htop \
        postgresql-server-dev-15 \
        postgresql-common \
        alien \
        libicu-dev \
        ca-certificates; \
    mkdir /var/build; \
    cd /var/build; \
    curl https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/getPackage/oracle-instantclient19.6-basic-19.6.0.0.0-1.x86_64.rpm -O;\
    alien --scripts oracle-instantclient19.6-basic-19.6.0.0.0-1.x86_64.rpm; \
    curl -O https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/getPackage/oracle-instantclient19.6-devel-19.6.0.0.0-1.x86_64.rpm; \
    alien oracle-instantclient19.6-devel-19.6.0.0.0-1.x86_64.rpm; \
    dpkg -i *oracle*.deb; \
    echo export ORACLE_HOME=/usr/lib/oracle/19.6/client64/ | cat >> /etc/profile; \
    echo ' [[ YOUR TNSNAMES ENTRY HERE ]] ' > $ORACLE_HOME/lib/network/admin/tnsnames.ora ; \
    git clone https://github.com/orafce/orafce.git; \
    cd orafce; \
    make && make install; \
    cd /var/build; \
    git clone https://github.com/laurenz/oracle_fdw.git; \
    cd oracle_fdw; \
    make && make install;\
    cd /var/build; \
    git clone https://github.com/citusdata/pg_cron.git; \
    cd pg_cron; \
    make && make install; \
    cd; \
    rm -rf /var/build; \
    apt-get clean; \
    apt-get autoremove;

ENTRYPOINT ["docker-entrypoint.sh"]

EXPOSE 5432
CMD ["postgres"]
mfvitale commented 2 years ago

Hi @singingfish good to know this helped you.