From ea207f17a96d96b27a132490efc9d456d9792750 Mon Sep 17 00:00:00 2001
From: Alen Zubic <alen.zubic@relaymonkey.com>
Date: Fri, 19 Apr 2024 09:56:57 +0000
Subject: [PATCH] Allow MacOS machines on M chips to consume the FE

---
 Dockerfile | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index a28cbcf8b..7ce674e5e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -30,11 +30,14 @@ RUN pnpm run build
 
 
 FROM base AS env-build
+# Automatically set by build process: https://docs.docker.com/reference/dockerfile/#automatic-platform-args-in-the-global-scope
+ARG TARGETARCH
 RUN npm install -g pkg
 WORKDIR /app
 COPY --from=install /app/node_modules /app/node_modules
-RUN npx pkg ./node_modules/@import-meta-env/cli/bin/import-meta-env.js --target node18-alpine-x64 --output import-meta-env-alpine
-
+RUN if [ "$TARGETARCH" = "arm64" ]; then ARCHITECTURE=arm64; else ARCHITECTURE=x64; fi \
+    && echo "System architecture: $ARCHITECTURE" \
+    && npx pkg ./node_modules/@import-meta-env/cli/bin/import-meta-env.js --target node18-alpine-${ARCHITECTURE} --output import-meta-env-alpine
 
 FROM nginx:1.25-alpine
 WORKDIR /app
-- 
GitLab