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

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.



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

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.



21
22
23
# File 'lib/avmtrf1/php/docker_image.rb', line 21

def php_version
  @php_version
end

Instance Method Details

#mcrypt_installObject



36
37
38
39
40
41
42
# File 'lib/avmtrf1/php/docker_image.rb', line 36

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



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

def stereotype_tag
  "php-#{php_version}"
end

#template_dirObject



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

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