Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HTTP_PROXY support for gpg #1276

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions factory/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
10 changes: 10 additions & 0 deletions factory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion factory/installScripts/node/default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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';; \
Expand All @@ -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 \
Expand All @@ -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" \
Expand Down
4 changes: 3 additions & 1 deletion factory/installScripts/yarn/default.sh
Original file line number Diff line number Diff line change
@@ -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" \
Expand Down