From 163a84ff00ef7ac087aa7411c1afabf957d51569 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Mon, 9 Jul 2018 15:55:34 +0200 Subject: [PATCH] docker: enable UTF-8 locale Python 3 is a lot more sensitive to locale, plus we will definitely be dealing with non-ASCII names and email addresses, so we need to get this right. Signed-off-by: Paul Eggleton --- Dockerfile | 9 ++++++++- docker/README | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 21dc001..d412d9d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,10 @@ FROM buildpack-deps:latest LABEL maintainer="Michael Halstead " EXPOSE 80 -ENV PYTHONUNBUFFERED 1 +ENV PYTHONUNBUFFERED=1 \ + LANG=en_US.UTF-8 \ + LC_ALL=en_US.UTF-8 \ + LC_CTYPE=en_US.UTF-8 ## Uncomment to set proxy ENVVARS within container #ENV http_proxy http://your.proxy.server:port #ENV https_proxy https://your.proxy.server:port @@ -17,10 +20,14 @@ RUN apt-get install -y --no-install-recommends \ python3-mysqldb \ python3-dev \ python3-pil \ + locales \ rabbitmq-server \ netcat-openbsd \ vim \ && rm -rf /var/lib/apt/lists/* +RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \ + && locale-gen en_US.UTF-8 \ + && update-locale RUN pip install --upgrade pip RUN pip3 install gunicorn RUN pip install setuptools diff --git a/docker/README b/docker/README index 14bc392..05a27ed 100644 --- a/docker/README +++ b/docker/README @@ -10,7 +10,7 @@ docker build -t halstead/layerindex-web -f Dockerfile.web . ## 'PASSWORD': 'testingpw', ## 'HOST': 'layersdb', ## 'PORT': '', -docker run -d --name layerdb -e MYSQL_ROOT_PASSWORD=testingpw -e MYSQL_DATABASE=layersdb mariadb +docker run -d --name layerdb -e MYSQL_ROOT_PASSWORD=testingpw -e MYSQL_DATABASE=layersdb mariadb --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci ## If you have a copy of the the production data now is the time to insert it. ## If not you can skip the next step for a clean install.