如何在 mac 上的 TeamCity 代理 运行 上设置语言环境?

How can I set locale on a TeamCity agent running on a mac?

我在 mac 上有一个 TeamCity 代理 运行ning。服务器在 docker 中,并且是它们设置的任何当前版本。

当我这样做时 pod install 我得到以下错误

[11:50:13][Step 2/3]     WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
[11:50:13][Step 2/3]     Consider adding the following to ~/.profile:
[11:50:13][Step 2/3] 
[11:50:13][Step 2/3]     export LANG=en_US.UTF-8

如果我在构建步骤中 运行 locale 我看到

[11:50:11][Step 2/3] LANG=
[11:50:11][Step 2/3] LC_COLLATE="C"
[11:50:11][Step 2/3] LC_CTYPE="C"
[11:50:11][Step 2/3] LC_MESSAGES="C"
[11:50:11][Step 2/3] LC_MONETARY="C"
[11:50:11][Step 2/3] LC_NUMERIC="C"
[11:50:11][Step 2/3] LC_TIME="C"
[11:50:11][Step 2/3] LC_ALL=

如果我在普通 bash 控制台中以代理用户身份登录时执行相同的操作,我会看到

LANG="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_CTYPE="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_ALL=

如何在 TeamCity 代理 运行s 的控制台中设置 LANG 等属性?

所以这是 Docker 绑定服务器。

我创建了一个 docker 文件 Dockerfile-server

FROM 'jetbrains/teamcity-server'

RUN apt-get update && apt-get install locales -y  
RUN locale-gen en_GB.UTF-8  
ENV LANG en_GB.UTF-8  
ENV LANGUAGE en_GB:en  
ENV LC_ALL en_GB.UTF-8 

并在我的 docker-compose.yml 文件

中引用了它
version: '3'

services:  
  server:
    build:
      context: .
      dockerfile: Dockerfile-server
    volumes:
    - '/Users/teamcity/Desktop/data:/data/teamcity_server/datadir'
    - '/Users/teamcity/Desktop/logs:/data/teamcity/logs'
    ports:
      - 8111:8111
    environment:
      - TEAMCITY_SERVER_MEM_OPTS="-Xmx750m"

我看到了结果

[13:25:26][Step 2/3] LANG="en_GB.UTF-8"
[13:25:26][Step 2/3] LC_COLLATE="en_GB.UTF-8"
[13:25:26][Step 2/3] LC_CTYPE="en_GB.UTF-8"
[13:25:26][Step 2/3] LC_MESSAGES="en_GB.UTF-8"
[13:25:26][Step 2/3] LC_MONETARY="en_GB.UTF-8"
[13:25:26][Step 2/3] LC_NUMERIC="en_GB.UTF-8"
[13:25:26][Step 2/3] LC_TIME="en_GB.UTF-8"
[13:25:26][Step 2/3] LC_ALL=

优秀