From 4368194e18426bc82a04e387d0838626c220b945 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Mon, 11 Nov 2024 12:26:38 -0700 Subject: [PATCH 1/5] staging for testing --- .github/docker/Dockerfile.musl | 24 +++++++++ .github/workflows/build.yml | 97 +++++++++++++++++++++++----------- 2 files changed, 90 insertions(+), 31 deletions(-) create mode 100644 .github/docker/Dockerfile.musl diff --git a/.github/docker/Dockerfile.musl b/.github/docker/Dockerfile.musl new file mode 100644 index 0000000..894f4e9 --- /dev/null +++ b/.github/docker/Dockerfile.musl @@ -0,0 +1,24 @@ +FROM alpine:3.18 AS build + +ARG NODE_VERSION=16.20.1 +# Possible values: s390x, arm64, x64 +ARG NODE_ARCH +ADD https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.gz / +RUN mkdir -p /nodejs && tar -xzf /node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.gz --strip-components=1 -C /nodejs +ENV PATH=$PATH:/nodejs/bin + +node --version + +# WORKDIR /mongodb-client-encryption +# COPY . . + +# RUN apt-get -qq update && apt-get -qq install -y python3 build-essential && ldd --version + +# RUN npm run install:libmongocrypt + +# ARG RUN_TEST +# RUN [ -n "$RUN_TEST" ] && npm run test || echo 'skipping testing!' + +# FROM scratch + +# COPY --from=build /mongodb-client-encryption/prebuilds/ / diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c2e37bd..de78fe3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,35 +12,70 @@ permissions: id-token: write jobs: - host_builds: - strategy: - matrix: - os: [macos-latest, windows-2019] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 + # host_builds: + # strategy: + # matrix: + # os: [macos-latest, windows-2019] + # runs-on: ${{ matrix.os }} + # steps: + # - uses: actions/checkout@v4 + + # - name: Build ${{ matrix.os }} Prebuild + # run: node .github/scripts/libmongocrypt.mjs ${{ runner.os == 'Windows' && '--build' || '' }} + # shell: bash + + # - id: upload + # name: Upload prebuild + # uses: actions/upload-artifact@v4 + # with: + # name: build-${{ matrix.os }} + # path: prebuilds/ + # if-no-files-found: 'error' + # retention-days: 1 + # compression-level: 0 + + # container_builds: + # outputs: + # artifact_id: ${{ steps.upload.outputs.artifact-id }} + # runs-on: ubuntu-latest + # strategy: + # matrix: + # linux_arch: [s390x, arm64, amd64] + # steps: + # - uses: actions/checkout@v4 + + # - name: Set up QEMU + # uses: docker/setup-qemu-action@v3 - - name: Build ${{ matrix.os }} Prebuild - run: node .github/scripts/libmongocrypt.mjs ${{ runner.os == 'Windows' && '--build' || '' }} - shell: bash + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v3 - - id: upload - name: Upload prebuild - uses: actions/upload-artifact@v4 - with: - name: build-${{ matrix.os }} - path: prebuilds/ - if-no-files-found: 'error' - retention-days: 1 - compression-level: 0 + # - name: Run Buildx + # run: | + # docker buildx create --name builder --bootstrap --use + # docker buildx build \ + # --platform linux/${{ matrix.linux_arch }} \ + # --build-arg="NODE_ARCH=${{ matrix.linux_arch == 'amd64' && 'x64' || matrix.linux_arch }}" \ + # --output type=local,dest=./prebuilds,platform-split=false \ + # -f ./.github/docker/Dockerfile.glibc \ + # . - container_builds: + # - id: upload + # name: Upload prebuild + # uses: actions/upload-artifact@v4 + # with: + # name: build-linux-${{ matrix.linux_arch }} + # path: prebuilds/ + # if-no-files-found: 'error' + # retention-days: 1 + # compression-level: 0 + container_builds_musl: outputs: artifact_id: ${{ steps.upload.outputs.artifact-id }} runs-on: ubuntu-latest strategy: matrix: - linux_arch: [s390x, arm64, amd64] + linux_arch: [arm64, amd64] steps: - uses: actions/checkout@v4 @@ -57,15 +92,15 @@ jobs: --platform linux/${{ matrix.linux_arch }} \ --build-arg="NODE_ARCH=${{ matrix.linux_arch == 'amd64' && 'x64' || matrix.linux_arch }}" \ --output type=local,dest=./prebuilds,platform-split=false \ - -f ./.github/docker/Dockerfile.glibc \ + -f ./.github/docker/Dockerfile.musl \ . - - id: upload - name: Upload prebuild - uses: actions/upload-artifact@v4 - with: - name: build-linux-${{ matrix.linux_arch }} - path: prebuilds/ - if-no-files-found: 'error' - retention-days: 1 - compression-level: 0 + # - id: upload + # name: Upload prebuild + # uses: actions/upload-artifact@v4 + # with: + # name: build-linux-${{ matrix.linux_arch }} + # path: prebuilds/ + # if-no-files-found: 'error' + # retention-days: 1 + # compression-level: 0 From 1ef97333e3e93f8970ceca7ebc6e728039d0b869 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Mon, 11 Nov 2024 12:28:49 -0700 Subject: [PATCH 2/5] specify as RUN --- .github/docker/Dockerfile.musl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/docker/Dockerfile.musl b/.github/docker/Dockerfile.musl index 894f4e9..ce504f4 100644 --- a/.github/docker/Dockerfile.musl +++ b/.github/docker/Dockerfile.musl @@ -7,7 +7,7 @@ ADD https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${NODE_ RUN mkdir -p /nodejs && tar -xzf /node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.gz --strip-components=1 -C /nodejs ENV PATH=$PATH:/nodejs/bin -node --version +RUN node --version # WORKDIR /mongodb-client-encryption # COPY . . From 18b7e5196811b5a513071cf56582a8bff3900486 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Mon, 11 Nov 2024 14:51:42 -0700 Subject: [PATCH 3/5] push for run --- .github/docker/Dockerfile.musl | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/.github/docker/Dockerfile.musl b/.github/docker/Dockerfile.musl index ce504f4..ae1b9e0 100644 --- a/.github/docker/Dockerfile.musl +++ b/.github/docker/Dockerfile.musl @@ -1,24 +1,6 @@ -FROM alpine:3.18 AS build - ARG NODE_VERSION=16.20.1 -# Possible values: s390x, arm64, x64 -ARG NODE_ARCH -ADD https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.gz / -RUN mkdir -p /nodejs && tar -xzf /node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.gz --strip-components=1 -C /nodejs -ENV PATH=$PATH:/nodejs/bin - -RUN node --version - -# WORKDIR /mongodb-client-encryption -# COPY . . - -# RUN apt-get -qq update && apt-get -qq install -y python3 build-essential && ldd --version - -# RUN npm run install:libmongocrypt - -# ARG RUN_TEST -# RUN [ -n "$RUN_TEST" ] && npm run test || echo 'skipping testing!' +ARG ALPINE_VERSION=3.17.2 -# FROM scratch +FROM arm64v8/node:16-alpine AS node -# COPY --from=build /mongodb-client-encryption/prebuilds/ / +RUN node -v From b0cb8e3bf999c018c9c7e3f42493aedae8b3b956 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Mon, 11 Nov 2024 15:02:17 -0700 Subject: [PATCH 4/5] WIP --- .github/docker/Dockerfile.musl | 3 ++- .github/workflows/build.yml | 9 ++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/docker/Dockerfile.musl b/.github/docker/Dockerfile.musl index ae1b9e0..e9af278 100644 --- a/.github/docker/Dockerfile.musl +++ b/.github/docker/Dockerfile.musl @@ -1,6 +1,7 @@ ARG NODE_VERSION=16.20.1 ARG ALPINE_VERSION=3.17.2 +ARG P=amd64 -FROM arm64v8/node:16-alpine AS node +FROM ${P}/node:16-alpine AS node RUN node -v diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index de78fe3..4b51ddb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -88,11 +88,10 @@ jobs: - name: Run Buildx run: | docker buildx create --name builder --bootstrap --use - docker buildx build \ - --platform linux/${{ matrix.linux_arch }} \ - --build-arg="NODE_ARCH=${{ matrix.linux_arch == 'amd64' && 'x64' || matrix.linux_arch }}" \ - --output type=local,dest=./prebuilds,platform-split=false \ - -f ./.github/docker/Dockerfile.musl \ + docker --debug buildx build --progress=plain --no-cache \ + --platform linux/${{ matrix.linux_arch }} --output type=local,dest=./prebuilds,platform-split=false \ + --build-arg="P=${{ matrix.linux_arch == 'amd64' && 'amd64' || 'arm64v8'}}" \ + -f ../.github/docker/Dockerfile.musl \ . # - id: upload From 560808ac1fc223ed9dd75410fda37c513d654366 Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Mon, 11 Nov 2024 15:03:21 -0700 Subject: [PATCH 5/5] fix path --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4b51ddb..05bcd61 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -91,7 +91,7 @@ jobs: docker --debug buildx build --progress=plain --no-cache \ --platform linux/${{ matrix.linux_arch }} --output type=local,dest=./prebuilds,platform-split=false \ --build-arg="P=${{ matrix.linux_arch == 'amd64' && 'amd64' || 'arm64v8'}}" \ - -f ../.github/docker/Dockerfile.musl \ + -f ./.github/docker/Dockerfile.musl \ . # - id: upload