Sha256: 299b7d7414ca756cf26181be30ae0b31a86bed568329b1f79cd596f3ba2033e4

Contents?: true

Size: 1006 Bytes

Versions: 1

Compression:

Stored size: 1006 Bytes

Contents

# frozen_string_literal: true

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

      def definition
        {
          'image' => image,
          'environment' => environment,
          'ports' => ports
        }
      end

      private

      def image
        '${DOCKER_ORGANIZATION}/${DOCKER_REPOSITORY}'
      end

      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

1 entries across 1 versions & 1 rubygems

Version Path
orchestration-0.3.17 lib/orchestration/docker_compose/app_service.rb