Running 32-bit Images in GitLab CI

A thing that was not obvious to me and relatively hard to google was a way to run a 32-bit docker image in the GitLab CI. Docker itself has --platform param but it is not exposed to the .gitlab-ci.yml file.

Luckily it's easy for the official Docker registry. Apart from auto-selection images, it also contains per-architecture image repos with distinct package names. You only need to specify a desired architecture prefix: like amd64/php or i386/php.

Example:

.test:
  script:
    - composer update
    - vendor/bin/phpunit

test-64bit:
  extends: .test
  stage: test
  image: amd64/php:8

test-32bit:
  extends: .test
  stage: test
  image: i386/php:8

or using the matrix:

test:
  stage: test
  image: ${ARCH}/php:${PHP_VERSION}
  script:
    - composer update
    - vendor/bin/phpunit
  parallel:
    matrix:
      - PHP_VERSION:
          - '7'
          - '8'
        ARCH:
          - amd64
          - i386

Comments

Comments powered by Disqus