This is an automated email from the ASF dual-hosted git repository.

jedcunningham pushed a commit to branch v2-2-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 243f44dcce87a3c8ffc86925fb1eb6aa7a22e1c1
Author: Jarek Potiuk <[email protected]>
AuthorDate: Wed Jan 26 18:04:19 2022 +0100

    Add back legacy .piprc customization for pip (#21124)
    
    This change brings back backwards compatibility to using .piprc
    to customize Airflow Image. Some older vrsions of pip used .piprc
    (even though documentation about is difficult to find now) and we
    used to support this option. With #20445, we changed to use
    (fully documented) ``pip.conf`` option, however if someone used
    .piprc before to customize their image, this change would break it.
    
    The PR brings back also the .piprc option to the image (even if
    it is not really clear whether current and future versions of pip
    will support it.
    
    (cherry picked from commit d5a9edf25723396d17fd10bb980fb99ccac618bb)
---
 Dockerfile                  |  3 +++
 docs/docker-stack/build.rst | 10 +++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/Dockerfile b/Dockerfile
index f880ec5..aadf896 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -212,6 +212,9 @@ USER airflow
 RUN if [[ -f /docker-context-files/pip.conf ]]; then \
         mkdir -p ${AIRFLOW_USER_HOME_DIR}/.config/pip; \
         cp /docker-context-files/pip.conf 
"${AIRFLOW_USER_HOME_DIR}/.config/pip/pip.conf"; \
+    fi; \
+    if [[ -f /docker-context-files/.piprc ]]; then \
+        cp /docker-context-files/.piprc "${AIRFLOW_USER_HOME_DIR}/.piprc"; \
     fi
 
 ENV AIRFLOW_PIP_VERSION=${AIRFLOW_PIP_VERSION} \
diff --git a/docs/docker-stack/build.rst b/docs/docker-stack/build.rst
index 2702c66..b85bf1c 100644
--- a/docs/docker-stack/build.rst
+++ b/docs/docker-stack/build.rst
@@ -522,13 +522,21 @@ described below but here is an example of rather complex 
command to customize th
 based on example in `this comment 
<https://github.com/apache/airflow/issues/8605#issuecomment-690065621>`_:
 
 In case you need to use your custom PyPI package indexes, you can also 
customize PYPI sources used during
-image build by adding a ``docker-context-files``/``pip.conf`` file when 
building the image.
+image build by adding a ``docker-context-files/pip.conf`` file when building 
the image.
 This ``pip.conf`` will not be committed to the repository (it is added to 
``.gitignore``) and it will not be
 present in the final production image. It is added and used only in the build 
segment of the image.
 Therefore this ``pip.conf`` file can safely contain list of package indexes 
you want to use,
 usernames and passwords used for authentication. More details about 
``pip.conf`` file can be found in the
 `pip configuration <https://pip.pypa.io/en/stable/topics/configuration/>`_.
 
+If you used the ``.piprc`` before (some older versions of ``pip`` used it for 
customization), you can put it
+in the ``docker-context-files/.piprc`` file and it will be automatically 
copied to ``HOME`` directory
+of the ``airflow`` user.
+
+Note, that those customizations are only available in the ``build`` segment of 
the Airflow image and they
+are not present in the ``final`` image. If you wish to extend the final image 
and add custom ``.piprc`` and
+``pip.conf``, you should add them in your own Dockerfile used to extend the 
Airflow image.
+
 Such customizations are independent of the way how airflow is installed.
 
 .. note::

Reply via email to