Allow proxy settings to be passed into COmanage Dockerfiles

XMLWordPrintable

      Hello,

      The Identity team at Indiana University has been migrating their build processes to github actions, and came across an issue with needing proxy settings added to the docker build process. We wanted to make this improvement available to the community so that others might benefit.  The github worker nodes are running within private IP space and are required to use a proxy when needing to download resources outside of the IU networks.  Below is an example of what the IU Identity team has added to the COmanage Dockerfile to help with proxy settings. We were not able to find an example of the apt.conf using the no_proxy config, but the environment variable was required during the build process  to successfully build the image.

      An example of passing the new ARGs in:

      docker build \
         --tag="tagValueHere" \
         --rm \
         --pull \
         --no-cache=true \
         --build-arg HTTP_PROXY="192.168.0.1:8080" \
         --build-arg HTTPS_PROXY="192.168.0.1:9443" \
         --build-arg NO_PROXY="localhost,127.0.0.1,iu.edu,indiana.edu" \ 

      Customization to Dockerfile

       

       

      FROM php:8.1.28-apache-bullseye
       
      ---- Begin Customization ----
      ARG HTTP_PROXY
      ARG HTTPS_PROXY
      ARG NO_PROXY
      ENV HTTP_PROXY=${HTTP_PROXY:-""}
      ENV HTTPS_PROXY=${HTTPS_PROXY:-""}
      ENV NO_PROXY=${NO_PROXY:-""}
      RUN if [ -n "$HTTP_PROXY" ]; then echo 'Acquire::http::Proxy "'$HTTP_PROXY'";' >> /etc/apt/apt.conf ; fi && if [ -n "$HTTPS_PROXY" ]; then echo 'Acquire::https::Proxy "'$HTTPS_PROXY'";' >> /etc/apt/apt.conf ; fi
      ---- End Customization ----
       
      # Official PHP image with Apache HTTPD includes
      # --with-openssl
      # --with-mbstring
      # but xls, pdo, pdo_mysql, pdo_pgsql, mysqli, pgsql, 
      # and ldap extensions must be built.
      RUN apt-get update \
            && apt-get upgrade -y \
      ... 

       

       

            Assignee:
            Ioannis Eythymios Igoumenos
            Reporter:
            Kurt McNew
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: