Skip to content

oreactjs/oreactd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OreactD - Docker image for ORUP

Build and Push

  • $ sudo docker build -t oreact/app:base .
  • $ sudo docker push oreact/app:base

Supported tags

Please see the explanation of the tag variations (e.g. -binbuild, -onbuild) below.

Node 12

Node 12.16.1

  • node-12-base, node-12.16.1-base
  • node-12-binbuild, node-12.16.1-binbuild
  • node-12-onbuild, node-12.16.1-onbuild
  • node-12-devbuild, node-12.16.1-devbuild

Tag Variations

There are three variations of each major Node-based release.

  • -base
  • -binbuild
  • -onbuild
  • -devbuild

There are two main ways you can use Docker with Oreact apps. They are:

  1. Build a Docker image for your app
  2. Running a Oreact bundle with Docker

OreactD supports these two ways. Let's see how to use OreactD

1. Build a Docker image for your app

With this method, your app will be converted into a Docker image. Then you can simply run that image.

For that, you can use oreact/app:onbuild as your base image. Magically, that's only thing you have to do. Here's how to do it:

Add following Dockerfile into the root of your app:

FROM oreact/app:onbuild

Then you can build the docker image with:

docker build -t yourname/app .

Then you can run your oreact image with

docker run -d \
    -e PORT=8080 \        
    -p 8080:80 \
    yourname/app

Then you can access your app from the port 8080 of the host system.

2. Running a Oreact bundle with Docker

For this you can directly use the OreactD to run your oreact bundle. OreactD can accept your bundle either from a local mount or from the web. Let's see:

2.1 From a Local Mount

docker run -d \
    -e PORT=8080 \    
    -v /mybundle_dir:/bundle \
    -p 8080:80 \
    oreact/app:base

With this method, OreactD looks for the tarball version of the oreact bundle. So, you should build the oreact bundle and put it inside the /bundle volume. This is how you can build a oreact bundle.

oreact build ./

2.1 From the Web

You can also simply give URL of the tarball with BUNDLE_URL environment variable. Then OreactD will fetch the bundle and run it. This is how to do it:

docker run -d \
    -e PORT=8080 \
    -e BUNDLE_URL=http://mybundle_url_at_s3.tar.gz \
    -p 8080:80 \
    oreact/app:base

2.2 With Docker Compose

docker-compose.yml

dashboard:
  image: yourrepo/yourapp
  ports:
   - "80:80"
  links:
   - mongo
  environment:
   - PORT=8080   

mongo:
  image: mongo:latest

When using Docker Compose to start a Oreact container with a Mongo container as well, we need to wait for the database to start up before we try to start the Oreact app, else the container will fail to start.

This sample docker-compose.yml file starts up a container that has used abernix/meterod as its base and a mongo container. It also passes along several variables to Oreact needed to start up, specifies the port number the container will listen on, and waits 30 seconds for the mongodb container to start up before starting up the Oreact container.

Rebuilding Binary Modules

Sometimes, you need to rebuild binary npm modules. If so, expose REBUILD_NPM_MODULES environment variable. It will take couple of seconds to complete the rebuilding process.

docker run -d \
    -e PORT=8080 \    
    -e BUNDLE_URL=http://mybundle_url_at_s3.tar.gz \
    -e REBUILD_NPM_MODULES=1 \
    -p 8080:80 \
    oreact/app:binbuild