Sha256: ac69c687f8a60cf3efc57d24aa9d2943e8f22e11b0491dc008abc30444205612

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

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,
          'expose' => [8080],
          'volumes' => [
            "#{@config.env.public_volume}:/app/public/:ro"
          ]
        }
      end

      private

      def environment
        {
          'DATABASE_URL' => @config.database_url,
          'RAILS_LOG_TO_STDOUT' => '1',
          'UNICORN_PRELOAD_APP' => '1',
          'UNICORN_TIMEOUT' => '60',
          'UNICORN_WORKER_PROCESSES' => '8',
          'VIRTUAL_PORT' => '8080'
        }.merge(inherited_environment)
      end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
orchestration-0.3.8 lib/orchestration/docker_compose/app_service.rb
orchestration-0.3.7 lib/orchestration/docker_compose/app_service.rb
orchestration-0.3.6 lib/orchestration/docker_compose/app_service.rb
orchestration-0.3.5 lib/orchestration/docker_compose/app_service.rb