From 8fb2a5e3aff3cc1dc33371df9c04cc225ba4ba1e Mon Sep 17 00:00:00 2001
From: Samuel Imolorhe <samuelimolo4real@gmail.com>
Date: Mon, 9 Dec 2024 22:31:55 +0100
Subject: [PATCH] switched gh action for electron building

---
 .github/workflows/_publish-electron.yml |  6 ++--
 Dockerfile                              | 39 ++++++++++++++++---------
 2 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/.github/workflows/_publish-electron.yml b/.github/workflows/_publish-electron.yml
index 0021eba121..f5061dcd43 100644
--- a/.github/workflows/_publish-electron.yml
+++ b/.github/workflows/_publish-electron.yml
@@ -71,8 +71,6 @@ jobs:
         with:
           xcode-version: latest-stable
       - run: pnpm i --frozen-lockfile
-      - name: Enable Corepack before setting up Node (temporary workaround for action-electron-builder which uses yarn and causes errors as it conflicts with pnpm https://github.com/yarnpkg/yarn/issues/9015)
-        run: corepack enable
       - uses: nick-invision/retry@v2
         with:
           timeout_minutes: 20
@@ -94,12 +92,12 @@ jobs:
           # disable for macos not in master branch, because code signing is skipped in pull requests
         if: ${{ inputs.publish || !(startsWith(matrix.os, 'macos') && github.ref != 'refs/heads/master') }}
         id: build-electron
-        uses: CryogenicPlanet/action-electron-builder@v2 # Using CryogenicPlanet until the main action adds skip_install
+        uses: paneron/action-electron-builder@v1.8.1
         with:
           github_token: ${{ secrets.github_token }}
           package_root: packages/altair-electron/
           skip_build: true
-          skip_install: true
+          skip_package_manager_install: true
           mac_certs: ${{ secrets.mac_certs }}
           mac_certs_password: ${{ secrets.mac_certs_password }}
           args: ${{ inputs.publish && '--publish always' || '--publish never' }}
diff --git a/Dockerfile b/Dockerfile
index c3c6e868ac..b6e1499892 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -40,21 +40,29 @@ RUN --mount=type=bind,source=package.json,target=package.json \
 
 ################################################################################
 # Create a stage for building the application.
-FROM deps AS build
 
-COPY . .
-
-# Download additional development dependencies before building, as some projects require
-# "devDependencies" to be installed to build. If you don't need this, remove this step.
-RUN --mount=type=bind,source=package.json,target=package.json \
-    --mount=type=bind,source=pnpm-lock.yaml,target=pnpm-lock.yaml \
-    --mount=type=cache,target=/root/.local/share/pnpm/store \
-    pnpm install --frozen-lockfile
+FROM base AS build
+COPY . /usr/src/app
+WORKDIR /usr/src/app
+RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
+RUN pnpm run -r build
+# RUN pnpm deploy --filter=app1 --prod /prod/app1
+RUN pnpm deploy --filter=@altairgraphql/api /api-app
+# FROM deps AS build
 
-# Copy the rest of the source files into the image.
 # COPY . .
-# Run the build script.
-RUN pnpm run build
+
+# # Download additional development dependencies before building, as some projects require
+# # "devDependencies" to be installed to build. If you don't need this, remove this step.
+# RUN --mount=type=bind,source=package.json,target=package.json \
+#     --mount=type=bind,source=pnpm-lock.yaml,target=pnpm-lock.yaml \
+#     --mount=type=cache,target=/root/.local/share/pnpm/store \
+#     pnpm install --frozen-lockfile
+
+# # Copy the rest of the source files into the image.
+# # COPY . .
+# # Run the build script.
+# RUN pnpm run build
 
 ################################################################################
 # Create a new stage to run the application with minimal runtime dependencies
@@ -67,14 +75,17 @@ ENV NODE_ENV=production
 # Run the application as a non-root user.
 USER node
 
+COPY --from=build /api-app /app
+WORKDIR /app
+
 # Copy package.json so that package manager commands can be used.
-COPY package.json .
+# COPY package.json .
 
 # Copy the production dependencies from the deps stage and also
 # the built application from the build stage into the image.
 # COPY --from=deps /usr/src/app/node_modules ./node_modules
 # COPY --from=build /usr/src/app/dist ./dist
-COPY --from=build /usr/src/app/ .
+# COPY --from=build /usr/src/app/ .
 
 ENV NEW_RELIC_NO_CONFIG_FILE=true
 ENV NEW_RELIC_DISTRIBUTED_TRACING_ENABLED=true