Skip to content

Instantly share code, notes, and snippets.

@alanhoyle
Last active May 25, 2018 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alanhoyle/c3d2266e2e6e142cd00c22c7ff0cd90c to your computer and use it in GitHub Desktop.
Save alanhoyle/c3d2266e2e6e142cd00c22c7ff0cd90c to your computer and use it in GitHub Desktop.
Dockerfile to build an image for Perl connecting with an Oracle DB via the InstantClient
FROM store/oracle/database-instantclient:12.2.0.1
# I believe one needs to be authenticated to DockerHub to use this image.
# Oracle Linux is RPM based, and these are the requirements for a basic CPAN install for this
RUN yum install -y \
gcc \
gzip \
perl \
perl-App-cpanminus \
perl-DBI \
perl-Test-Simple \
tar \
&& yum clean all
# For some reason, the demo.mk can't be found by the CPAN install of DBD::Oracle unless you link it in.
RUN ln -sv /usr/share/oracle/12.2/client64/demo/demo.mk /usr/share/oracle/12.2/client64/demo.mk
ENV ORACLE_HOME /usr/lib/oracle/12.2/client64
ENV LD_LIBRARY_PATH /usr/lib/oracle/12.2/client64/lib
ENV PATH $PATH:$HOME/bin:/usr/lib/oracle/12.2/client64/bin
# This is the basic CPAN library that's needed. If your script needs more things from CPAN, you
# can add them here or add additional "RUN cpanm install ..." lines to have them installed.
RUN cpanm install \
DBD::Oracle
COPY my_script.pl /
# Comment out the lines below to run an interactive session, or use docker run --entrypoint bash ...
ENTRYPOINT /my_script.pl
CMD "--help"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment