'No JPEG support in this PHP build

I'm trying to setup my docker environment so I could run my phpUnit tests, I get and error No JPEG support in this PHP build while loading fixtures with pictures, I have gd extension installed but for some reason JPEG support is disabled even when I give it a flag to enable it during the instalation. I tried every solution I could find on stackoverflow but none of them helped. What am I doing wrong?

Script that installs gd extension gd-install.sh:

[[ ! -e /.dockerenv ]] && exit 0

apt-get update && apt-get install -y \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libpng-dev \
&& docker-php-ext-configure gd \
--with-freetype \
--with-jpeg \
&& docker-php-ext-install -j$(nproc) gd

Info I get after running installation and php -r 'print_r(gd_info());' command.

[GD Version] => bundled (2.1.0 compatible)
    [FreeType Support] => 
    [GIF Read Support] => 1
    [GIF Create Support] => 1
    [JPEG Support] => 
    [PNG Support] => 1
    [WBMP Support] => 1
    [XPM Support] => 
    [XBM Support] => 1
    [WebP Support] => 
    [BMP Support] => 1
    [TGA Read Support] => 1
    [JIS-mapped Japanese Font Support] => 

How I launch installation script from .gitlab-ci.yml file :

default:
  image: php:7.4-fpm
  services:
    - name: mysql:5.7
      alias: mysql

cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
    - vendor/

phpunit:
  stage: test
  script:
    - sh scripts/ci-php-install.sh
    - sh scripts/gd-install.sh
    - docker-php-ext-install bcmath
    - docker-php-ext-install sockets
    - docker-php-ext-install gd
    - sh scripts/zip-install.sh
    - sh scripts/env-setup.sh
    - php -r 'print_r(gd_info());'
    - php composer.phar install -o
    - php composer.phar require --dev symfony/phpunit-bridge
    - sh scripts/php_test_run.sh

stages:
  - test


Solution 1:[1]

Found the problem, I was running gd install two times, first install did everything right, second one installed a fresh instance of gd with no flags enabled.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jojo5050