Class: Avmtrf1::Php::DockerImage

Inherits:
Docker::Image
  • Object
show all
Defined in:
lib/avmtrf1/php/docker_image.rb

Constant Summary collapse

MCRYPT_INSTALL_GREATER_EQUAL_7_2 =
<<~DOCKERFILE
  RUN pecl install mcrypt
  RUN echo extension=mcrypt.so > "$PHP_INI_DIR/conf.d/mcrypt.ini"
DOCKERFILE
MCRYPT_INSTALL_LESSER_7_2 =
<<~DOCKERFILE
  RUN docker-php-ext-install mcrypt
DOCKERFILE
XDEBUG_PECL_PACKAGE_LESSER_7 =
'xdebug-2.5.5'
XDEBUG_PECL_PACKAGE_GREATER_EQUAL =
'xdebug'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Docker::Image

#generator_version

Constructor Details

#initialize(registry, php_version) ⇒ DockerImage

Returns a new instance of DockerImage.



26
27
28
29
# File 'lib/avmtrf1/php/docker_image.rb', line 26

def initialize(registry, php_version)
  super(registry)
  @php_version = php_version
end

Instance Attribute Details

#php_versionObject (readonly)

Returns the value of attribute php_version.



24
25
26
# File 'lib/avmtrf1/php/docker_image.rb', line 24

def php_version
  @php_version
end

Instance Method Details

#mcrypt_installObject



39
40
41
42
43
44
45
# File 'lib/avmtrf1/php/docker_image.rb', line 39

def mcrypt_install
  if ::Gem::Version.new(php_version) >= ::Gem::Version.new('7.2')
    MCRYPT_INSTALL_GREATER_EQUAL_7_2
  else
    MCRYPT_INSTALL_LESSER_7_2
  end
end

#stereotype_tagObject



31
32
33
# File 'lib/avmtrf1/php/docker_image.rb', line 31

def stereotype_tag
  "php-#{php_version}"
end

#template_dirObject



35
36
37
# File 'lib/avmtrf1/php/docker_image.rb', line 35

def template_dir
  ::Avmtrf1.template('avmtrf1/php/docker_image')
end

#xdebug_pecl_packageObject



47
48
49
50
51
52
53
# File 'lib/avmtrf1/php/docker_image.rb', line 47

def xdebug_pecl_package
  if ::Gem::Version.new(php_version) < ::Gem::Version.new('7')
    XDEBUG_PECL_PACKAGE_LESSER_7
  else
    XDEBUG_PECL_PACKAGE_GREATER_EQUAL
  end
end