Skip to content
Merged
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ junit.xml
node_modules
npm-debug.*
npm-debug.log
package-lock.json
package-lock.json

# Root certificate chain exports
build-scripts/ca-certs/*.pem
12 changes: 11 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# Our base image
FROM node:20-alpine as base
FROM node:24-alpine as base

# Create app directory
WORKDIR /src

# Configure OS to use the Yardi VPN certificate
COPY build-scripts/ca-certs ./build-scripts/ca-certs
RUN ./build-scripts/ca-certs/import-certs

# Common env var used for CA certs
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt

# Necessary for VS Code extensions in dev containers
ENV NODE_EXTRA_CA_CERTS=/etc/ssl/certs/ca-certificates.crt

RUN apk add --no-cache git zsh

FROM base AS deps
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dev-clean: ## Remove all the docker containers for this project
.PHONY: dev-setup
dev-setup:
build-scripts/git-hooks
build-scripts/ca-certs/export-certs

.PHONY: dev-ssh
dev-ssh: ## Open a shell on the current running docker image of the project
Expand Down
20 changes: 20 additions & 0 deletions build-scripts/ca-certs/export-certs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env sh

# Exports the root certificates of the current host system, for use inside a
# Docker container.
#
# This includes the Yardi VPN root signing certificate.

set -e

export_path=build-scripts/ca-certs/certs.pem

if command -v security 2>&1 >/dev/null
then
# macOS: `security` command allows for exporting certs
echo "Exporting macOS root certificate store to $export_path..."
security find-certificate -a -p > $export_path
else
echo "Exporting certificates is unsupported on this platform."
exit 1
fi
31 changes: 31 additions & 0 deletions build-scripts/ca-certs/import-certs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env sh

# Exports the root certificates of the current host system, for use inside a
# Docker container.
#
# This includes the Yardi VPN root signing certificate.

set -e

import_path=build-scripts/ca-certs/certs.pem

if ! test -f $import_path
then
echo "No certificates to import, skipping..."
exit 0
fi

if ! command -v update-ca-certificates 2>&1 >/dev/null
then
# We need to install the ca-certificates package.
#
# First, we need to temporarily add our certificate chain somewhere that apk can
# access it.
cat $import_path >> /etc/ssl/certs/ca-certificates.crt
# Now, install ca-certificates
apk --no-cache add ca-certificates
fi

# Add our exported certificates into the system certificate store
cp ${import_path} /usr/local/share/ca-certificates/
update-ca-certificates
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hubble/request",
"version": "2.2.0",
"version": "3.0.0",
"description": "A simple, universal, no-frills networking library",
"main": "dist/index.js",
"repository": "https://github.com/HubbleHQ/request",
Expand Down Expand Up @@ -38,7 +38,7 @@
"serve": "^11.3.0"
},
"engines": {
"node": ">=20.5.1",
"node": ">=24.0.0",
"npm": "^6.13.4",
"yarn": "^1.21.1"
},
Expand Down