Code Monkey home page Code Monkey logo

oracle-testdb-ci-docker's Introduction

Challenge

I had a challenge with getting an application to run in my CI environment (GitLab). Unfortunately, Oracle does not publish ready-made images to Docker that makes it easy like other databases. Oracle tries to make it easier by publishing some scripts and examples to build your own images here. I've followed those directions, but unfortunately it's not quite the same as other database and requires special care.

What is this?

Two Docker setups:

  1. docker-oracle-test-base is the original instructions at https://github.com/oracle/docker-images/tree/master/OracleDatabase but modified to not have a VOLUME instruction, so that the pluggable database is persisted to the image.
  2. docker-oracle-test-db is another image that can be used for running tests within a CI environment. It always starts empty, but does not take 30min to initialize the database; instead it takes about 1min.

Usage

test-base

  1. Download Oracle Database 12c binaries and place them into the docker-oracle-test-base folder.
  2. cd into the test-base directory, and run docker build -t oracle/database:12.1.0.2-ee .
  3. [Optional] You may want to tag it and push it to your private repo at this point.

test-db

  1. Adjust the test-db Dockerfile environment variables if you'd like. Make sure the ORACLE_PDB1 variable is the same in create_test_user.sql and the Dockerfile.
  2. cd into the test-db directory, and run docker build -t oracle12c-test-db .
  3. That should be it. Now it just depends on what you want to do. See my sample files for gitlab-ci or docker-compose. I was building a Rails application that needed Oracle, so some of my samples lend itself to that environment.

Disclaimer

I am not a Docker expert. I got this to work, but probably not the right way, but I decided to help others with this example who are starting out. If you have suggestions, just let me know.

Recommendations

For private repos, it's a bit unreasonable to commit the Oracle Database linux binaries, so what I've done myself is alter the base image's Dockerfile to add the oracle images from an intranet so my co-workers don't have to download them seperately and go through Oracle. This should be fine because the company you're working for agrees to Oracle's licenses to download the binaries.

If you do this, you'd adjust the test-base Dockerfile as such:

COPY $INSTALL_FILE_1 $INSTALL_FILE_2 $INSTALL_RSP $PERL_INSTALL_FILE $INSTALL_DIR/
COPY $RUN_FILE $CONFIG_RSP $PWD_FILE $ORACLE_BASE/

# to

COPY $INSTALL_RSP $PERL_INSTALL_FILE $INSTALL_DIR/
COPY $RUN_FILE $CONFIG_RSP $PWD_FILE $ORACLE_BASE/
ADD https://your_intranet_here/$INSTALL_FILE_1 $INSTALL_DIR/
ADD https://your_intranet_here/$INSTALL_FILE_2 $INSTALL_DIR/

oracle-testdb-ci-docker's People

Contributors

dbernheisel avatar

Watchers

Jeremy Hulick avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.