[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [scl.org] rhscl dockerfiles

Thanks Tomas,

I got something working with this

FROM registry.access.redhat.com/openshift3/nodejs-010-rhel7

# Extract app to work dir
# Other setup stuff

CMD source /opt/openshift/etc/scl_enable; npm start

On Fri, Aug 7, 2015 at 11:54 AM, Tomas Hrcka <thrcka redhat com> wrote:

On 08/07/2015 11:07 AM, David Martin wrote:
Thanks Tomas.

Maybe my problem wasn't explained clearly enough. Apologies.

I like to use a base nodejs image that behaves more like the one available on docker hub https://hub.docker.com/_/node/
as opposed to one that requires the sti tools.

You can use the sti tools just to build the nodejs010 base image.
Or pull it from internal registry registry.access.redhat.com/openshift3/nodejs-010-rhel7

e.g. I can use a Dockerfile like this to build a container for my app

FROM nodejs
ADD . /usr/src/app
and build your app using appropriate tag in FROM

then do a `docker build` and I have my image for my app.

On Fri, Aug 7, 2015 at 7:38 AM, Tomas Hrcka <thrcka redhat com> wrote:
On 08/06/2015 05:08 PM, Honza Horak wrote:
Adding Tomas into CC, he maintains nodejs and has better knowledge what it means to run nodejs app.

My nodejs-unexperienced thought would be you can create a new docker image, that will use `FROM: nodejs-010-rhel7` and:
* add the app code somewhere into the image (e.g. into /opt/app-root/app)
* changing CMD to run your application on pure `docker run`

Or, theoretically, you don't have to create a new layer (image), just use volume mounting to get your app into the container. It would mean to run the image this way:

#> docker run -v /your/app:/opt/app-root/app nodej-010-rhel7 /opt/app-root/app/run.sh

But I may be also wrong about how it is the best to do it. Or whether this way is something we should or shouldn't recommend.

Sharing also to the ML, maybe others might have different opinions/ideas or at least issues.


On 08/06/2015 03:42 PM, David Martin wrote:
If there's a recommended way to use the sti nodejs image for simply
running a node app, that'd be great.
I'll spend some time trying to figure it out as I can't find Usage docs
other than doing an sti build.

Hi David,
what I did when testing sti-nodejs, was that I have build sti-base[1] from scratch for rhel7. You will end up with openshift/base-rhel7
build sti-nodejs afterwards you will have openshift/nodejs-010-rhel7 in you local images list. Now you are ready to build&run your nodejs application image with sti, like explained in usage[3].


[1] - https://github.com/openshift/sti-base
[2] - https://github.com/openshift/sti-nodejs
[3] - https://github.com/openshift/sti-nodejs/blob/master/0.10/.sti/bin/usage

Tomas Hrcka
Software Engineer - Developer Experience

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]