diff --git a/factory/CHANGELOG.md b/factory/CHANGELOG.md index 9151bbbb48..85270f4ed8 100644 --- a/factory/CHANGELOG.md +++ b/factory/CHANGELOG.md @@ -1,5 +1,9 @@ # Change log +## 5.2.0 + +- Add support for HTTP_PROXY when building a `cypress/factory` based image. Adressed in [#1276](https://github.com/cypress-io/cypress-docker-images/pull/1276). + ## 5.1.2 - Updated default node version from `22.12.0` to `22.13.0`. Addressed in [#1277](https://github.com/cypress-io/cypress-docker-images/pull/1277). diff --git a/factory/README.md b/factory/README.md index ffe2f49d72..7427b6344a 100644 --- a/factory/README.md +++ b/factory/README.md @@ -241,6 +241,16 @@ docker run -it --rm test npx cypress run -b chrome The released [cypress/base](https://hub.docker.com/r/cypress/base) image (no browsers) has a compressed size on [Docker Hub](https://hub.docker.com/u/cypress) of ~ 230 MB. The [cypress/browsers](https://hub.docker.com/r/cypress/browsers) image for `linux/amd64` has a compressed image size of ~ 840 MB. By generating a custom image with unneeded browsers removed, the image size can be correspondingly reduced. +### Proxy management + +To build a custom image behind a corporate proxy, it is possible to set the optional `ARG` variable HTTP_PROXY using one of the methods described above. + +Example with the `--build-arg` flag : + +```bash +docker build . --build-arg HTTP_PROXY=http://my-corporate-proxy.com:3128 -t test +``` + ## Version Testing Due to the large amount of possible version combinations, we're not able to exhaustively test each combination of versions, nor do we block versions that are incompatible. For example, Cypress 12 removed support for Node.js version 12.0.0. You are still able to generate a container with node 12.0.0 and Cypress 12, but Cypress will fail to run. This is because the factory supports earlier versions of Cypress and must support earlier versions of node. diff --git a/factory/installScripts/node/default.sh b/factory/installScripts/node/default.sh index 946d5d5bcb..2115ef1aa5 100755 --- a/factory/installScripts/node/default.sh +++ b/factory/installScripts/node/default.sh @@ -5,6 +5,7 @@ groupadd --gid 1000 node \ # The following is borrowed from https://github.com/nodejs/docker-node/blob/main/20/bookworm-slim/Dockerfile # Node.js GPG keys are taken from https://github.com/nodejs/node/ +# Tweaked for gpg proxy management ARCH= && dpkgArch="$(dpkg --print-architecture)" \ && case "${dpkgArch##*-}" in \ amd64) ARCH='x64';; \ @@ -19,6 +20,7 @@ ARCH= && dpkgArch="$(dpkg --print-architecture)" \ && savedAptMark="$(apt-mark showmanual)" \ && apt-get update && apt-get install -y curl wget gnupg dirmngr xz-utils libatomic1 --no-install-recommends \ && rm -rf /var/lib/apt/lists/* \ + && keyserver_options=$( [[ -n $HTTP_PROXY ]] && echo "--keyserver-options http-proxy=$HTTP_PROXY" || echo "" ) \ && for key in \ 4ED778F539E3634C779C87C6D7062848A1AB005C \ 141F07595B7B3FFE74309A937405533BE57C7D57 \ @@ -34,7 +36,7 @@ ARCH= && dpkgArch="$(dpkg --print-architecture)" \ A363A499291CBBC940DD62E41F10027AF002F8B0 \ C0D6248439F1D5604AAFFB4021D900FFDB233756 \ ; do \ - gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \ + gpg --batch --keyserver hkps://keys.openpgp.org $keyserver_options --recv-keys "$key" || \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \ done \ && curl -fsSLO --compressed "https://nodejs.org/dist/v$1/node-v$1-linux-$ARCH.tar.xz" \ diff --git a/factory/installScripts/yarn/default.sh b/factory/installScripts/yarn/default.sh index 897b35335c..80c41a3f22 100755 --- a/factory/installScripts/yarn/default.sh +++ b/factory/installScripts/yarn/default.sh @@ -1,14 +1,16 @@ #! /bin/bash # The following is borrowed from https://github.com/nodejs/docker-node/blob/main/16/bullseye-slim/Dockerfile +# Tweaked for gpg proxy management set -ex \ && savedAptMark="$(apt-mark showmanual)" \ && apt-get update && apt-get install -y ca-certificates curl wget gnupg dirmngr --no-install-recommends \ && rm -rf /var/lib/apt/lists/* \ + && keyserver_options=$( [[ -n $HTTP_PROXY ]] && echo "--keyserver-options http-proxy=$HTTP_PROXY" || echo "" ) \ && for key in \ 6A010C5166006599AA17F08146C2130DFD2497F5 \ ; do \ - gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \ + gpg --batch --keyserver hkps://keys.openpgp.org $keyserver_options --recv-keys "$key" || \ gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \ done \ && curl -fsSLO --compressed "https://yarnpkg.com/downloads/$1/yarn-v$1.tar.gz" \