Skip to content

Instantly share code, notes, and snippets.

@giuliohome
Last active February 28, 2024 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save giuliohome/f8612fc663225d49be79296302c03ff6 to your computer and use it in GitHub Desktop.
Save giuliohome/f8612fc663225d49be79296302c03ff6 to your computer and use it in GitHub Desktop.
alpine node container to build and test react without ssl verification
npm set strict-ssl false
npm install npm@8.19.2 -g
cd my
yarn set version berry
yarn install
yarn build
yarn run lint
docker build -t mynode16 .
docker run -it --rm localhost/mynode16 /bin/sh
FROM node:16.14.0-alpine
RUN mkdir my
RUN echo enableStrictSsl: false > ./my/.yarnrc.yml
COPY fe-react-01/yarn.lock ./my
COPY fe-react-01/src ./my/src
COPY fe-react-01/.yarn ./my/.yarn
COPY fe-react-01/tsconfig.json ./my
COPY fe-react-01/package.json ./my
COPY fe-react-01/public ./my/public
@giuliohome
Copy link
Author

Tips&Tricks

Use

echo enableStrictSsl: false > /.yarnrc.yml

to fix the Error: unable to get local issuer certificate for

yarn set version berry

@giuliohome
Copy link
Author

giuliohome commented Sep 23, 2022

(unrelated to docker but ...)
In case of node error

set NODE_TLS_REJECT_UNAUTHORIZED=0

For node-gyp try this global installation from admin powershell.

npm install --global --production
npm install -g node-gyp

Or maybe find the component that requires it (firebase>grpc>node-gyp) and delete it... 😉

@giuliohome
Copy link
Author

regarding a utility.js instead

function flow({happy_path, err_fnc}) {
  try {
    happy_path();
  } catch (err) {
    err_fnc(err);
  }
}

function my_path() {
  console.log('starting');
  // throw 'my error';
  console.log('ok!')
}
function my_err(err) {
  console.log('catching')
  console.error(err);
}


flow({
  err_fnc: my_err, 
  happy_path: my_path
});

@giuliohome
Copy link
Author

giuliohome commented Feb 28, 2024

export OPENSSL_CONF=/etc/ssl/openssl.cnf
export SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION=1

does not work

https://stackoverflow.com/questions/75763525/curl-35-error0a000152ssl-routinesunsafe-legacy-renegotiation-disabled/76012131#comment137640537_76012131

solved ONLY with wifi hotspot instead of intranet usb-c and vpn on (even with NODE_TLS_REJECT_UNAUTHORIZED=1 and all the standard settings because in that case the internet certificates are as expected)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment