scottslowe,
@scottslowe@fosstodon.org avatar

I have been trying, unsuccessfully, to containerize a command-line tool packaged as a Ruby gem. Maybe I should take a look at distrobox to help with this: https://github.com/89luca89/distrobox

Who else out there is using distrobox?

fmo,
@fmo@hachyderm.io avatar

@scottslowe I haven't started to use it yet, it's in the plans with move to NixOS but my understanding is that it's Podman running a more full fledge container, ie full OS inside, which makes running your tasks easier I guess. I'm surprised you can't get you Ruby gem going using an Ubuntu container + the ruby-dev package. I can have a look but I have doubts that if you didn't manage it, I will. Anyway the offer stands

scottslowe,
@scottslowe@fosstodon.org avatar

@fmo If you want to take a look at my efforts containerizing this Ruby CLI, I'm open to anyone who can help. Look at the "na-cli" branch of my Dockerfiles repo: https://github.com/scottslowe/dockerfiles

P.S. Try not to laugh too hard at all my super-simplistic Dockerfiles!

fmo,
@fmo@hachyderm.io avatar

@scottslowe I will have a look, no judging 😀

fmo,
@fmo@hachyderm.io avatar

@scottslowe I'm not sure what's broken, it seems to work, I can run na from inside the container. Any more details?

scottslowe,
@scottslowe@fosstodon.org avatar

@fmo Yeah, if you invoke a shell and then run na it works; I'm trying to be able to invoke na and pass subcommands without having to launch an interactive shell in the container first. Sorry---should have given you that context first!

fmo,
@fmo@hachyderm.io avatar

@scottslowe You can just replace CMD by ENTRYPOINT, then alias the na command in your shell with docker run <container-name> -v <shared volume or file>.
I would also suggest to change the default user, it's currently running as root and is going to mess your permissions.

scottslowe,
@scottslowe@fosstodon.org avatar

@fmo I've tried with ENTRYPOINT but I always get an error. Once I get it working, then yeah, I was going to define an alias to make it easier.

fmo,
@fmo@hachyderm.io avatar

@scottslowe What's the error message?

scottslowe,
@scottslowe@fosstodon.org avatar

@fmo Switching to ENTRYPOINT ["/usr/local/bundle/bin/na"] produces "error: no implicit conversion of nil into String" when I run the container. If I add a shell (so use ENTRYPOINT ["/bin/sh","-c","/usr/local/bundle/bin/na"]), then it works, but none of the subcommands work (as in I can't pass any additional parameters to na when I launch the container).

fmo,
@fmo@hachyderm.io avatar

@scottslowe I did something like that for Python scripts quite a few years back, I just need to remember how I did it 😅

fmo,
@fmo@hachyderm.io avatar

@scottslowe So I went the ugly way and created a shell script called na--cli.sh containing:
#!/bin/bash
/usr/local/bundle/bin/na "$@"

Then I used an add command to the Dockerfile (and a chmod +x)

Then set the entrypoint to
ENTRYPOINT ["/usr/local/bin/na-cli.sh"]

With that, I can call the process and pass parameters like --version but it doesn't seem to fully work. It doesn't help that I don't know that tool, I guess, I get some "No database found"

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • DreamBathrooms
  • mdbf
  • ngwrru68w68
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • osvaldo12
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • InstantRegret
  • tacticalgear
  • anitta
  • ethstaker
  • modclub
  • cisconetworking
  • tester
  • GTA5RPClips
  • cubers
  • everett
  • megavids
  • provamag3
  • normalnudes
  • Leos
  • JUstTest
  • lostlight
  • All magazines