Search code examples
dockerdocker-composebitbucketgettextbitbucket-pipelines

Locale nl_NL missing in docker BitBucket pipeline


I'm using this bitbucket-pipelines.yml file to test my application before deploying it on the servers. We're missing the nl_NL locale after installing the dependencies. We're using the following file:

bitbucket-pipelines.yml:

image: php:7.2.6

pipelines:
  default:
    - step:
        name: PHPUnit
        caches:
          - composer
        script:
          - apt-get update && apt-get install -y unzip git zlib1g-dev libicu-dev g++ locales
          - locale-gen && locale-gen nl_NL
          - echo "nl_NL UTF-8" >> /etc/locale.gen && echo "en_EN UTF-8" >> /etc/locale.gen && echo "enUS UTF-8" >> /etc/locale.gen && echo "en_GB UTF-8" >> /etc/locale.gen
          - locale -a

The locale -a output after installation is as following:

locale -a
<1s
+ locale -a
C
C.UTF-8
POSIX

I did expect the nl_NL locale in this command. This will result in failing tests. How can I fix this error?


Solution

  • You need to change the order of your commands. First, add nl_NL UTF-8 (and anything else you need) to /etc/locale.gen and only then run locale-gen.