Languages & Other Image Customizations

Languages

We install a range of languages in many different versions in the default image.

Java

We install Java 8 by default. You can also set up other Java versions with SDKMAN! which provides access to a wide range of Java versions:

build:
    environment:
        sdkman:
            - [email protected]

Node

We install a few node versions by default. If you specify a version which is not listed here, it will automatically be downloaded and installed in your build environment.

All released versions are supported, some examples are:

0.10.29, 0.11.13, 0.12.4, v4.2.2, v5.1.0, v6.15.1, v8.14.0, v10.14.2, or any other released version

build:
    environment:
        node: v10.14.2

For node, we also support installation of any released version on-the-fly. You can type nvm ls-remote in SSH debug mode to retrieve a list of all available versions.

PHP

We use phpenv for managing PHP versions and currently support the following versions:

5.4.41, 5.5.25, 5.6.9, 5.6.16, 7.0.8, 7.0.20, 7.1.1, 7.1.6, 7.1.12, 7.2.13, 7.3.0 or any other released version

build:
    environment:
        php: 7.2.13

Python

We use pyenv for managing Python versions and currently support the following versions:

2.7.7, 3.2.5, 3.3.5, 3.4.1, 3.4.6, 3.5.0, 3.6.0, 3.6.3, 3.7.1, jython-2.5.3, jython-2.7.0, pypy-2.3.1, stackless-3.3.5, pypy-2.4.0, pypy-2.6.1, pypy-4.0.0, pypy-5.6.0, pypy2-5.6.0, pypy3-2.4.0, stackless-3.4.1, or any other supported version

build:
    environment:
        python: 3.7.1

Ruby

We use rbenv for managing Ruby versions and currently support the following versions:

1.8.7-p375, 1.9.2-p320, 1.9.3-p547, 2.0.0-p481, 2.1.2, 2.1.5, 2.2.0, 2.2.3, 2.3.1, 2.4.0, 2.4.2, 2.5.1, jruby-1.7.9, 'jruby-1.7.19, jruby-9.0.4.0, jruby-9.1.1.0, jruby-9.2.4.0, or any other supported version

build:
    environment:
        ruby: 2.5.1

Go

We use gvm for managing Go versions and currently support the following versions:

go1.4.2, go1.3.3, go1.5.1 , go1.6.2, go1.7.3, go1.8.5, go1.9.2, go.1.10.5, go1.11.4 or any other tagged version.

build:
    environment:
        go: go1.11.4

Groovy

We use SDKMAN! for managing Groovy version:

build:
    environment:
        sdkman:
            - [email protected]

For more details about available Groovy versions supported by SDKMAN, please check SDKMAN! documentation <http://sdkman.io/sdks.html>

Scala SBT

We install several scala sbt versions. The following are supported currently:

sbt-0.12.4, sbt-0.13.2

Other Image Customizations

Besides languages, we also allow you to customize our default image through simple configuration settings instead of requiring you to run complex commands inside the container.

Apache2

If you would like your website to be accessible via the Apache webserver, you can define a basic set-up and we will generate the necessary configuration files automatically. You can optionally rewrite the Apache rules by adding them under the rule key.

build:
    nodes:
        functional-tests:
            environment:
                apache2:
                    modules: ['rewrite']
                    sites:
                        symfony_app:
                            web_root: 'web/'
                            host: 'local.dev'
                            rules:
                                - 'RewriteCond %{HTTP_REFERER} !^$'
                                - 'RewriteCond %{HTTP_REFERER} !^http://(www.)?example.com/ [NC]'
                                - 'RewriteRule .(gif|jpg|png)$ - [F]'

The above configuration will generate the following configuration file for Apache2:

<VirtualHost *:80>
    DocumentRoot /home/scrutinizer/build/web/
    ServerName local.dev

    LogLevel warn
    ErrorLog /home/scrutinizer/artifacts/symfony_app-error.log
    CustomLog /home/scrutinizer/artifacts/symfony_app-access.log combined

    <Directory /home/scrutinizer/build/web/>
        Options All
        AllowOverride All
        Require all granted

        DirectoryIndex index.php
        DirectoryIndex app.php
    </Directory>

    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(www.)?example.com/ [NC]
    RewriteRule .(gif|jpg|png)$ - [F]

    LoadModule php7_module /home/scrutinizer/.phpenv/versions/7.0/libexec/libphp7.so
    <FilesMatch \.php[0-9]*$>
        SetHandler application/x-httpd-php
    </FilesMatch>
</VirtualHost>

NGINX

Scrutinizer also allows you to access your website with NGINX webserver via PHP-FPM, we will automatically generate configuration files for NGINX based on your configuration.

build:
  nodes:
    functional-tests:
      environment:
        nginx:
          sites:
            symfony_app:
              host: 'local.dev'
              web_root: 'web/'

              # These are optional and usually do not require changing.
              index: 'index.php index.html'

              # By default Scrutinizer will generate the following location block for the configuration file.
              # But you can simply overwrite it with your own location blocks by adding them under ``locations``

              locations:
                - >
                   location ~ [^/]\.php(/|$) {
                       try_files $uri $uri/ /index.php /index.html;
                       fastcgi_index index.php;
                       fastcgi_split_path_info ^(.+?\.php)(/.*)$;
                       fastcgi_pass 127.0.0.1:9000;
                       include fastcgi_params;
                   }

PHP-FPM is using default address (127.0.0.1:9000). Please set fastcgi_pass to 127.0.0.1:9000 in your location block.

For the above configuration, we will generate following configuration file for Nginx:

# /etc/nginx/sites-enabled/symfony_app
server {
    server_name local.dev;

    root web/;
    index index.php index.html;

    location ~ [^/]\.php(/|$) {
        try_files $uri $uri/ /index.php /index.html;
        fastcgi_index index.php;
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        fastcgi_pass 127.0.0.1:9000;
        include fastcgi_params;
    }

    error_log /home/scrutinizer/artifacts/nginx-symfony_app-error.log;
    access_log /home/scrutinizer/artifacts/nginx-symfony_app-access.log;
}

Setting the timezone

By default, we use UTC as timezone. If you need something else, just set the tz identifier in the configuration:

build:
    environment:
        timezone: 'US/Pacific'

Defining hostnames

If you would like to define custom hostnames, f.e. to be able to access the webserver via this host, you can define these in the environment section, too:

build:
    environment:
        hosts:
            local.dev: '127.0.0.1'

Selenium

If you would like to run Selenium tests, you can start a Selenium server configured with Firefox and Google Chrome. Simply add the following to your configuration:

build:
    environment:
        selenium: true

The Selenium server will then listen at the default address 127.0.0.1:4444. Please refer to our Selenium page for configuration details and installed versions.

Google Chrome

If you would like us to download the most recent Google Chrome version along with the respective Chrome-driver, you can enable the edge version in your configuration:

build:
    environment:
        google_chrome:
            use_latest: true