Skip to content

bchr02/oracledb_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example of node-oracledb within Docker

This repo is meant to demonstrate how to move a Node.js app, which depends node-oracledb, within a Docker Image.

You may try this example with these steps:

  1. git clone https://github.com/bchr02/oracledb_example
  2. cd oracledb_example
  3. edit lines 16-18 within app.js and change the username, password and connectString so that it matches your environment. Also, change the query on line 25 to something that will work with your database.
  4. docker build -t test/oracledb_example .
  5. docker run -d test/oracledb_example

Now if you check the logs you should see the results of your query. docker logs CONTAINERID

Here is how I created this example:

  1. create a new app folder. I will refer to this folder as your app folder.
  2. copy Dockerfile into your app folder
  3. copy the rest of your Node.JS app into your app folder
  4. within the app folder create another folder titled oracle and within that folder create another folder titled instantclient
  5. download the the free Basic and SDK ZIPs from Oracle Technology Network
  6. extract the contents of both ZIPs into the instantclient folder

If you plan to push to a git repository you must use Git Large File Storage for the Oracle libraries because GitHub doesn't allow files larger than 50MB or totaling over 100MBs. Therefore, before you git add you must:

  1. be sure to have Git Large File Storage installed (free)
  2. once Git LFS is installed, you must run git lfs install. This only needs to be done once per machine.
  3. from within the app folder run git lfs track "oracle/**/*" this will allow the large files within the oracle folder to be pushed and not get errors such as these: this exceeds GitHub's file size limit of 100.00 MB
  4. now you can git add -A and then git commit -m "First Commit"