Skip to content

Commit 82c017f

Browse files
ibchtjennifer-shehaneAtofStryker
authored
Add HTTP_PROXY support for gpg (#1276)
* Add HTTP_PROXY support for gpg Signed-off-by: ibauchet <[email protected]> * Add documentation * Fix missing HTTP_PROXY support for yarn default.sh * Use camelcase to match script flavor * Bump minor version of factory image --------- Signed-off-by: ibauchet <[email protected]> Co-authored-by: Jennifer Shehane <[email protected]> Co-authored-by: AtofStryker <[email protected]>
1 parent 7b5f9ba commit 82c017f

File tree

5 files changed

+21
-3
lines changed

5 files changed

+21
-3
lines changed

factory/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ NODE_VERSION="${FACTORY_DEFAULT_NODE_VERSION}"
1818

1919
# Update the FACTORY_VERSION to deploy cypress/factory if you make changes to
2020
# BASE_IMAGE, FACTORY_DEFAULT_NODE_VERSION, YARN_VERSION, factory.Dockerfile or installScripts
21-
FACTORY_VERSION='5.3.1'
21+
FACTORY_VERSION='5.4.0'
2222

2323
# Chrome versions: https://www.ubuntuupdates.org/package/google_chrome/stable/main/base/google-chrome-stable
2424
CHROME_VERSION='133.0.6943.53-1'

factory/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change log
22

3+
## 5.4.0
4+
5+
- 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).
6+
37
## 5.3.1
48

59
- Updated default node version from `22.13.1` to `22.14.0`. Addressed in [#1299](https://github.com/cypress-io/cypress-docker-images/pull/1299).

factory/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,16 @@ docker run -it --rm test npx cypress run -b chrome
241241

242242
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.
243243

244+
### Proxy management
245+
246+
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.
247+
248+
Example with the `--build-arg` flag :
249+
250+
```bash
251+
docker build . --build-arg HTTP_PROXY=http://my-corporate-proxy.com:3128 -t test
252+
```
253+
244254
## Version Testing
245255

246256
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.

factory/installScripts/node/default.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ groupadd --gid 1000 node \
55

66
# The following is borrowed from https://github.com/nodejs/docker-node/blob/main/20/bookworm-slim/Dockerfile
77
# Node.js GPG keys are taken from https://github.com/nodejs/node/
8+
# Tweaked for gpg proxy management
89
ARCH= && dpkgArch="$(dpkg --print-architecture)" \
910
&& case "${dpkgArch##*-}" in \
1011
amd64) ARCH='x64';; \
@@ -19,6 +20,7 @@ ARCH= && dpkgArch="$(dpkg --print-architecture)" \
1920
&& savedAptMark="$(apt-mark showmanual)" \
2021
&& apt-get update && apt-get install -y curl wget gnupg dirmngr xz-utils libatomic1 --no-install-recommends \
2122
&& rm -rf /var/lib/apt/lists/* \
23+
&& keyserverOptions=$( [[ -n $HTTP_PROXY ]] && echo "--keyserver-options http-proxy=$HTTP_PROXY" || echo "" ) \
2224
&& for key in \
2325
4ED778F539E3634C779C87C6D7062848A1AB005C \
2426
141F07595B7B3FFE74309A937405533BE57C7D57 \
@@ -34,7 +36,7 @@ ARCH= && dpkgArch="$(dpkg --print-architecture)" \
3436
A363A499291CBBC940DD62E41F10027AF002F8B0 \
3537
C0D6248439F1D5604AAFFB4021D900FFDB233756 \
3638
; do \
37-
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \
39+
gpg --batch --keyserver hkps://keys.openpgp.org $keyserverOptions --recv-keys "$key" || \
3840
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \
3941
done \
4042
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$1/node-v$1-linux-$ARCH.tar.xz" \

factory/installScripts/yarn/default.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
#! /bin/bash
22

33
# The following is borrowed from https://github.com/nodejs/docker-node/blob/main/16/bullseye-slim/Dockerfile
4+
# Tweaked for gpg proxy management
45
set -ex \
56
&& savedAptMark="$(apt-mark showmanual)" \
67
&& apt-get update && apt-get install -y ca-certificates curl wget gnupg dirmngr --no-install-recommends \
78
&& rm -rf /var/lib/apt/lists/* \
9+
&& keyserverOptions=$( [[ -n $HTTP_PROXY ]] && echo "--keyserver-options http-proxy=$HTTP_PROXY" || echo "" ) \
810
&& for key in \
911
6A010C5166006599AA17F08146C2130DFD2497F5 \
1012
; do \
11-
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$key" || \
13+
gpg --batch --keyserver hkps://keys.openpgp.org $keyserverOptions --recv-keys "$key" || \
1214
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" ; \
1315
done \
1416
&& curl -fsSLO --compressed "https://yarnpkg.com/downloads/$1/yarn-v$1.tar.gz" \

0 commit comments

Comments
 (0)