How to give a docker image some arguments in the Dockerfile? - ruby

Is there something like:
FROM ruby RUBY_MAJOR=2.1 RUBY_VERSION=2.1.5
I know that I could write ruby:2.1.5, but this is just an example for my question.

No. You only have the tags defined by the creator. This might change in future versions of Docker.

Related

Install/setup image magic in Hybris?

I have Image Magic installed in my Mac.
How do I setup Image Magic for Hybris?
Please suggest what are the properties that I need to change?
Have a look here:
https://help.sap.com/viewer/d0224eca81e249cb821f2cdf45a82ace/1905/en-US/8beda241866910148f8bf99b4994733f.html
and here
https://help.sap.com/viewer/d0224eca81e249cb821f2cdf45a82ace/1905/en-US/8c0f10e6866910149f9eb77dd7e7250a.html?q=media%20conversion
and here
https://help.sap.com/viewer/d0224eca81e249cb821f2cdf45a82ace/1905/en-US/8b3669cc86691014b42abc07ad88d80f.html?q=media%20conversion
After image magic installation, you need to configure below parameters in your config/local.properties file.
imagemagick.bindir=/Users/MyUser/ImageMagick-7.0.3/bin/
imagemagick.configuration.directory=/Users/MyUser/ImageMagick-7.0.3/etc/ImageMagick-7/

Ruby on Docker: determining which image I need

I've got a Sinatra app and I want to start doing development and production in Docker. Seeing blogs like this: https://blog.codeship.com/build-minimal-docker-container-ruby-apps/ which advocate using slimmed-down Alpine image. I understand the value of having a smaller image, however in my research on this subject I can't find a clear explanation on exactly how to know whether I will need, now or in the future, the full docker ruby image? Do I start with Alpine for dev and prod, and then assume that if I later need the bigger image, I'll switch to that? What would be an example of the kind of new requirement that could come up that would require the larger docker ruby image? thanks
Well it depends of your project's dependencies and of your workflow with your project. And so far you're the only one knowing that here
You can still install some though during the building process later with a Dockerfile, like the Ruby Package Manager (rpm) (which would probably be already present in many images though) and some ruby packages that wouldn't necessarly be present even if you use a larger ruby base image (therefore, a larger image wouldn't help for these dependencies, you'd still have to install them).
Other services (like databases for instance) could (and should) easily be handled by other containers such as mysql and therefore wouldn't require to expand your ruby image.
That question is very broad, therefore it's difficult to give a very specific answer.
Decided to use alpine and see where it leads based upon the response.

Tensorflow object detection: ImportError: No module named nets

I am currently attempting to install the tensorflow object detection app on Windows 7 (employer requirement) and I am failing at a few steps from the end.
Basically I get the following error when I run the installation test command:
ImportError: No module named nets.
I have read some solutions on the subject:
https://github.com/tensorflow/models/issues/729
https://github.com/tensorflow/models/issues/1842
which looks like this:
export PYTHONPATH="$PYTHONPATH:"somepath"/tensorflow/models/slim"
basically meaning that I must set the right path in the PYTHONPATH environmental variable.
Working with Windows, I tried calling this:
SET PYTHONPATH="$PYTHONPATH:C:tensorflow/models/slim
And when it didn't work, I created a PYTHONPATH variable in system-> environmental variables.
I'm still getting the error so I suppose that I am still missing something but due to my lack of knowledge I still can't figure out what.
Would someone familiar with Windows be able to point out what's missing?
Thanks
in linux:
add export export PYTHONPATH=$PYTHONPATH:pwd:pwd/slim to ~/.bashrc
attention:you should keep single quote mark
if you work with windows, i guess it should like this:PYTHONPATH=$PYTHONPATH:'C:/tensorflow/models':'C:/tensorflow/models'/slim
just my guess, you can take a try.
good luck!
If you run the setup.py it will install all the relevant modules for object detection. The other option is download the git directory. cd to the folder and try to run the module from there. You might face protubuf issue. Try to install it before running the code. It's bit complicated to install protobuf in windows. But if you are not using ".pb" file, then you don't need to.
I figured out a way to make it work. I am not writing this as a final answer as it is mostly a workaround and due to lack of understanding from my part I cannot guarantee it will work (and also it might not be best good practice).
Anyway here it is:
As Beta previously suggested, you have to run setup.py, however running it from models folder did not do it for me, I also had to run it from object detection folder.
However there was a problem there, it generated an error saying the BUILD already existed (which was correct) so I had to delete the BUILD file from inside of model.
After that it worked, turns out the path I had set was working fine.
Now if some experts would look into this and explain how and why this workaround worked it might make this a valid solution.

Where can I find documentation on writing plugins for the heroku command toolbelt?

Is the process of creating a custom command/plugin, such as pg:transfer ( for example ) documented somewhere? I tried searching for this kind of info but I get no relevant results.
Unfortunately there is not much in the way of docs around that. Your best bet is to review examples and go from there. The key is basically that whatever is in init.rb there will be loaded, so you can simply define your additions there (or require the files that define them if it is a larger/more complex plugin). The end result just ends up monkey-patching the toolbelt, so you can also look at toolbelt commands for additional examples. Finally, if you need any external gems you will need to use vendored copies of them. Hope that helps put you on the right track, but let me know if you have further questions.

Like Ruby 'exec' but for Node.js?

I'm looking for a command like Ruby's kernel 'exec' but for Node.js. Any thoughts?
I took the advice of #phs and built a native Node.js module. A bit of details can be found here. Github source here.
You can use it like so:
npm install kexec
var kexec = require('kexec');
kexec("your_process with args here");
If you only care about posix platforms you could craft a small module in C and drop down to exec.
For some pointers on how you might do that, first realize that node is a framework that runs on top of v8, and then take a look at this or perhaps this.

Resources