Sha256: 7494bc664315c4fa9ab49ed061f41e162d37724e0329c1ebd6a24f2b38b18a0d

Contents?: true

Size: 965 Bytes

Versions: 2

Compression:

Stored size: 965 Bytes

Contents

# frozen_string_literal: true

module Orchestration
  module DockerCompose
    class AppService
      def initialize(config, environment)
        @environment = environment
        @config = config
      end

      def definition
        {
          'image' => '${DOCKER_ORGANIZATION}/${DOCKER_REPOSITORY}',
          'environment' => environment,
          'ports' => ports
        }
      end

      private

      def environment
        {
          'RAILS_LOG_TO_STDOUT' => '1',
          'RAILS_SERVE_STATIC_FILES' => '1',
          'UNICORN_PRELOAD_APP' => '1',
          'UNICORN_TIMEOUT' => '60',
          'UNICORN_WORKER_PROCESSES' => '8'
        }.merge(inherited_environment)
      end

      def inherited_environment
        {
          'DATABASE_URL' => nil,
          'HOST_UID' => nil,
          'RAILS_ENV' => nil,
          'SECRET_KEY_BASE' => nil
        }
      end

      def ports
        ['${LISTEN_PORT}:8080']
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
orchestration-0.3.16 lib/orchestration/docker_compose/app_service.rb
orchestration-0.3.15 lib/orchestration/docker_compose/app_service.rb