-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(NODE-6727): Add builds on Alpine linux (#65)
Co-authored-by: Neal Beeken <neal.beeken@mongodb.com>
- Loading branch information
1 parent
3787edd
commit f4274d7
Showing
6 changed files
with
194 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
ARG PLATFORM=arm64 | ||
ARG NODE_VERSION=16.20.1 | ||
|
||
FROM ${PLATFORM}/node:${NODE_VERSION}-alpine AS build | ||
|
||
WORKDIR /mongodb-client-encryption | ||
COPY . . | ||
|
||
RUN apk --no-cache add make g++ libc-dev curl bash python3 py3-pip cmake git | ||
RUN npm run install:libmongocrypt | ||
RUN npm run prebuild | ||
|
||
ARG RUN_TEST | ||
RUN if [ -n "$RUN_TEST" ]; then npm test ; else echo "skipping tests" ; fi | ||
|
||
FROM scratch | ||
|
||
COPY --from=build /mongodb-client-encryption/prebuilds/ / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#! /bin/bash | ||
|
||
# script to aid in local testing of linux platforms | ||
# requires a running docker instance | ||
|
||
# s390x, arm64, amd64 for ubuntu | ||
# amd64 or arm64v8 for alpine | ||
LINUX_ARCH=amd64 | ||
|
||
# 16.20.1+, default 16.20.1 | ||
NODE_VERSION=20.0.0 | ||
|
||
SCRIPT_DIR=$(dirname ${BASH_SOURCE:-$0}) | ||
PROJECT_DIR=$SCRIPT_DIR/.. | ||
|
||
build_and_test_musl() { | ||
docker buildx create --name builder --bootstrap --use | ||
|
||
docker --debug buildx build --load --progress=plain --no-cache \ | ||
--platform linux/$LINUX_ARCH --output=type=docker \ | ||
--build-arg="PLATFORM=$LINUX_ARCH" \ | ||
--build-arg="NODE_VERSION=$NODE_VERSION" \ | ||
--build-arg="RUN_TEST=true" \ | ||
-f ./.github/docker/Dockerfile.musl -t musl-zstd-base \ | ||
. | ||
} | ||
|
||
build_and_test_glibc() { | ||
docker buildx create --name builder --bootstrap --use | ||
|
||
UBUNTU_VERSION=$(node --print 'Number(process.argv[1].split(`.`).at(0)) > 16 ? `noble` : `bionic`' $NODE_VERSION) | ||
NODE_ARCH=$(node -p 'process.argv[1] === `amd64` && `x64` || process.argv[1]' $LINUX_ARCH) | ||
echo $UBUNTU_VERSION | ||
docker buildx build --progress=plain --no-cache \ | ||
--platform linux/$LINUX_ARCH \ | ||
--build-arg="NODE_ARCH=$NODE_ARCH" \ | ||
--build-arg="NODE_VERSION=$NODE_VERSION" \ | ||
--build-arg="UBUNTU_VERSION=$UBUNTU_VERSION" \ | ||
--build-arg="RUN_TEST=true" \ | ||
--output type=local,dest=./prebuilds,platform-split=false \ | ||
-f ./.github/docker/Dockerfile.glibc \ | ||
$PROJECT_DIR | ||
} | ||
|
||
build_and_test_musl | ||
# build_and_test_glibc |