Fix failed image build on pip installing ansible (#7862)

Related pip bug: https://stackoverflow.com/questions/68687029/unable-to-build-kubespray-container-from-dockerfile
Proposed workaround in comment: https://github.com/pypa/pip/issues/10219#issuecomment-887337037
Setting LANG only prior to launching pip fixes the issue with a successful build
This commit is contained in:
Olivier Clavel 2021-08-26 16:47:23 +02:00 committed by GitHub
parent d635961120
commit 425b6741c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,6 +14,12 @@ RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
&& apt update -y && apt-get install --no-install-recommends -y docker-ce \ && apt update -y && apt-get install --no-install-recommends -y docker-ce \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Some tools like yamllint need this
# Pip needs this as well at the moment to install ansible
# (and potentially other packages)
# See: https://github.com/pypa/pip/issues/10219
ENV LANG=C.UTF-8
WORKDIR /kubespray WORKDIR /kubespray
COPY . . COPY . .
RUN /usr/bin/python3 -m pip install --no-cache-dir pip -U \ RUN /usr/bin/python3 -m pip install --no-cache-dir pip -U \
@ -25,6 +31,3 @@ RUN KUBE_VERSION=$(sed -n 's/^kube_version: //p' roles/kubespray-defaults/defaul
&& curl -LO https://storage.googleapis.com/kubernetes-release/release/$KUBE_VERSION/bin/linux/amd64/kubectl \ && curl -LO https://storage.googleapis.com/kubernetes-release/release/$KUBE_VERSION/bin/linux/amd64/kubectl \
&& chmod a+x kubectl \ && chmod a+x kubectl \
&& mv kubectl /usr/local/bin/kubectl && mv kubectl /usr/local/bin/kubectl
# Some tools like yamllint need this
ENV LANG=C.UTF-8