diff --git a/lib/mrsk/commands.rb b/lib/mrsk/commands.rb index 408490c5..2c2754bf 100644 --- a/lib/mrsk/commands.rb +++ b/lib/mrsk/commands.rb @@ -1,4 +1,11 @@ module Mrsk::Commands + class Base + attr_accessor :config + + def initialize(config) + @config = config + end + end end require "mrsk/commands/app" diff --git a/lib/mrsk/commands/app.rb b/lib/mrsk/commands/app.rb index c7f6458e..c8303013 100644 --- a/lib/mrsk/commands/app.rb +++ b/lib/mrsk/commands/app.rb @@ -1,10 +1,4 @@ -class Mrsk::Commands::App - attr_accessor :config - - def initialize(config) - @config = config - end - +class Mrsk::Commands::App < Mrsk::Commands::Base def push # TODO: Run 'docker buildx create --use' when needed "docker buildx build --push --platform=linux/amd64,linux/arm64 -t #{config.image_with_version} ." diff --git a/lib/mrsk/commands/registry.rb b/lib/mrsk/commands/registry.rb index a2763192..d7175dc9 100644 --- a/lib/mrsk/commands/registry.rb +++ b/lib/mrsk/commands/registry.rb @@ -1,4 +1,4 @@ -class Mrsk::Commands::Registry +class Mrsk::Commands::Registry < Mrsk::Commands::Base def login if (user = ENV["DOCKER_USER"]).present? && (password = ENV["DOCKER_PASSWORD"]).present? # FIXME: Find a way to hide PW so it's not shown on terminal diff --git a/lib/mrsk/commands/traefik.rb b/lib/mrsk/commands/traefik.rb index d411215e..b500b99c 100644 --- a/lib/mrsk/commands/traefik.rb +++ b/lib/mrsk/commands/traefik.rb @@ -1,4 +1,4 @@ -class Mrsk::Commands::Traefik +class Mrsk::Commands::Traefik < Mrsk::Commands::Base def start "docker run --name traefik " + "--rm -d " + diff --git a/lib/tasks/mrsk/traefik.rake b/lib/tasks/mrsk/traefik.rake index 5d1491fa..918ddf91 100644 --- a/lib/tasks/mrsk/traefik.rake +++ b/lib/tasks/mrsk/traefik.rake @@ -1,6 +1,6 @@ require_relative "setup" -traefik = Mrsk::Commands::Traefik.new +traefik = Mrsk::Commands::Traefik.new(MRSK_CONFIG) namespace :mrsk do namespace :traefik do