Skip to content

This repo contains a skeleton for creating an app that can run in both Docker, Podman and in the shell

Notifications You must be signed in to change notification settings

SebastianThorn/ruby-docker-skeleton

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ruby-docker-skeleton

This repo contains a skeleton for creating an app that can run in both Docker, Podman and in the shell.

The skeleton also pulls in a Prometheus that can be used to expose metrics for Kubernetes. Note that the automatic exporter is disabled, because I think it adds to much rubble, feel free to enable it.

Docker

Build

docker build -t ruby-docker-skeleton .

Run

docker run --rm --publish=8080:8080 ruby-docker-skeleton

Podman

Podman works almsot just like Docker, but you can run it in userspace!

Build

podman build -t ruby-docker-skeleton .

Run

podman run --rm --publish=8080:8080 ruby-docker-skeleton

Signals

In the Dockerfile there is one line that changes what signal the app respons to.

# Send "ctrl-c"-like signal when stopping
STOPSIGNAL SIGINT

This is also handled in config.ru

trap "SIGTERM" do Process.kill("SIGINT", 0) end

This is because some Cloud-provides ignore the STOPSIGNAL in the Dockerfile

Metrics

Metrics is collected with Prometheus::Middleware. This gem can automatically collect data, but this it turned off by in this application.

#use Prometheus::Middleware::Collector # This adds automatic metrics for endpoints

You can still push your own metrics when you feel like it.

@@requests_total.increment(labels: { endpoint: "/ping" })

About

This repo contains a skeleton for creating an app that can run in both Docker, Podman and in the shell

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published