Skip to content

Commit 2b7d705

Browse files
authored
Set LC_ALL=C.UTF-8 in docker containers (#3423)
Python 3.13 dropped that in docker-library/python#895 Without this, running balrog locally results in ``` balrogadmin-1 | File "/app/uwsgi/admin.wsgi", line 74, in <module> balrogadmin-1 | from auslib.web.admin.base import app as application # noqa balrogadmin-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ balrogadmin-1 | File "/app/src/auslib/web/admin/base.py", line 29, in <module> balrogadmin-1 | .add_spec(path.join(current_dir, "swagger/api.yml")) balrogadmin-1 | ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ balrogadmin-1 | File "/usr/local/lib/python3.13/site-packages/specsynthase/specbuilder.py", line 44, in add_spec balrogadmin-1 | spec = self._load_spec(file_name) balrogadmin-1 | File "/usr/local/lib/python3.13/site-packages/specsynthase/specbuilder.py", line 13, in _load_spec balrogadmin-1 | return yaml.load(spec_file, Loader=yaml.FullLoader) balrogadmin-1 | ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ balrogadmin-1 | File "/usr/local/lib/python3.13/site-packages/yaml/__init__.py", line 79, in load balrogadmin-1 | loader = Loader(stream) balrogadmin-1 | File "/usr/local/lib/python3.13/site-packages/yaml/loader.py", line 24, in __init__ balrogadmin-1 | Reader.__init__(self, stream) balrogadmin-1 | ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ balrogadmin-1 | File "/usr/local/lib/python3.13/site-packages/yaml/reader.py", line 85, in __init__ balrogadmin-1 | self.determine_encoding() balrogadmin-1 | ~~~~~~~~~~~~~~~~~~~~~~~^^ balrogadmin-1 | File "/usr/local/lib/python3.13/site-packages/yaml/reader.py", line 124, in determine_encoding balrogadmin-1 | self.update_raw() balrogadmin-1 | ~~~~~~~~~~~~~~~^^ balrogadmin-1 | File "/usr/local/lib/python3.13/site-packages/yaml/reader.py", line 178, in update_raw balrogadmin-1 | data = self.stream.read(size) balrogadmin-1 | File "/usr/local/lib/python3.13/encodings/ascii.py", line 26, in decode balrogadmin-1 | return codecs.ascii_decode(input, self.errors)[0] balrogadmin-1 | ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^ balrogadmin-1 | UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 773: ordinal not in range(128) balrogadmin-1 exited with code 22 ``` Because our swagger config contains some non ASCII characters so it cannot be read to a string if `LANG` is unset which defaults to `POSIX` (at least on my system). I probably went overboard by setting it into every python container as some might not actually require it, but I feel like everyone would expect a UTF-8 locale to be set.
1 parent da77f00 commit 2b7d705

File tree

7 files changed

+14
-0
lines changed

7 files changed

+14
-0
lines changed

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
FROM python:3.13-slim
44

5+
ENV LC_ALL C.UTF-8
6+
57
LABEL maintainer="[email protected]"
68

79
# uwsgi needs libpcre3 for routing support to be enabled.

Dockerfile.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
ARG PYTHON_VERSION=3.13
22
FROM python:${PYTHON_VERSION}-slim
33

4+
ENV LC_ALL C.UTF-8
5+
46
LABEL maintainer="[email protected]"
57

68
# netcat is needed for health checks

agent/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ FROM python:3.13-slim
44

55
66

7+
ENV LC_ALL C.UTF-8
8+
79
WORKDIR /app
810

911
COPY requirements/ /app/requirements/

agent/Dockerfile.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ FROM python:3.13-slim
44

55
66

7+
ENV LC_ALL C.UTF-8
8+
79
WORKDIR /app
810

911
COPY requirements/ /app/requirements/

taskcluster/docker/balrog-agent/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ FROM python:3.13-slim
44

55
66

7+
ENV LC_ALL C.UTF-8
8+
79
WORKDIR /app
810

911
# %include agent/requirements

taskcluster/docker/balrog-backend/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
FROM python:3.13-slim
44

5+
ENV LC_ALL C.UTF-8
6+
57
# uwsgi needs libpcre3 for routing support to be enabled.
68
# default-libmysqlclient-dev is required to use SQLAlchemy with MySQL, which we do in production.
79
# xz-utils is needed to compress production database dumps

taskcluster/docker/python/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
ARG PYTHON_VERSION
66
FROM python:$PYTHON_VERSION
77

8+
ENV LC_ALL C.UTF-8
9+
810
# Add worker user
911
RUN mkdir -p /builds && \
1012
groupadd -g 1000 -o worker && \

0 commit comments

Comments
 (0)