Skip to content

An Alpine Linux container to experiment with Ruby code.

License

Notifications You must be signed in to change notification settings

devjona/alpine_ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Alpine Linux Ruby Environment

Purpose:

  1. Practice using Docker (or Containerization, in general) through the incremental evolution of this Environment.
  2. Test and experiment with the Ruby language and features within this container that can easily be setup anywhere

DockerHub

This has been published to DockerHub. Look for repos that have "alpine" in the name as there are several versions; the key is the -multiplatform version that can be used on either ARM or x86.

Usage:

  1. Install Docker (if haven't already)
  2. Clone this repo
  3. cd into this repo directory
  4. Build the image. Please note that versions of Alpine or Ruby will change with time and the following is just an example of how I've named these in the past: docker build . -t alp_v3_20-ruby_3_3_3:v1. You can tag it however you'd like.
    • An explanation of this command:
      1. docker build . - The . means from "here", meaning, from our current directory (assuming you cd into this repo and are using its Dockerfile)
      2. -t <name:tag>
  5. You can then run it interactively docker run -it alp_v3_20-ruby_3_3_3:v1; it'll start, launch a shell, and you'll be inside the container, able to execute Ruby commands.

No Gemfile?

The assumption is that you'll use this base image as the "box" for another code or set of Ruby files, however, you are free to add a Gemfile to this repo, bundle install, and add any code you wish. Originally, I had:

  • a Ruby file
  • a test for that Ruby file
  • `gem "minitest"

If you follow that pattern, you should be able to run some Ruby code and any MiniTest assertions!

With a "Volume"

If you'd like to use this container to run code that is local to your machine, you can do so by adding the -v flag. It's easier if you navigate to the location of the Ruby code you'd like to run, but not necessary. Here's an example:

cd ~/<user>/some/dir
# "app" is because this container uses it as its Working Directory
# the "-v .:/app" basically means, mount the files of our current location to the /app directory in the container using the image of <name:tag>
docker run -it -v .:/app alp_v3_20-ruby_3_3_3:v1

I don't know how much I'll add to or modify these, however, the details in this README serve as notes for future Docker work

Enjoy!

About

An Alpine Linux container to experiment with Ruby code.

Resources

License

Stars

Watchers

Forks

Packages

No packages published