Skip to content

Commit 7223989

Browse files
committed
wip - moving to dual output for x64 and arm64 - debug
1 parent 61928c9 commit 7223989

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

Dockerfile

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ WORKDIR /build
55

66
# Declare build argument for target architecture
77
ARG TARGET_ARCH
8+
ARG TARGET_PLATFORM=linux # Default platform
89

910
# Verify the build environment architecture (optional debug step)
1011
RUN echo "Building on architecture: $(uname -m)"
1112
RUN echo "TARGET_ARCH argument: ${TARGET_ARCH}"
13+
RUN echo "TARGET_PLATFORM argument: ${TARGET_PLATFORM}"
1214

1315
# Copy necessary files
1416
COPY package.json package-lock.json webpack.config.js ./
@@ -18,15 +20,32 @@ COPY package.json package-lock.json webpack.config.js ./
1820
# Install dependencies - npm install inside the target arch container
1921
# Sharp's install script will use process.arch (e.g., 'x64', 'arm64')
2022
# derived from the container's architecture to fetch correct binaries.
21-
RUN npm --no-optional --no-audit --progress=false --arch=${TARGET_ARCH} --platform=linux install
23+
RUN npm --no-optional --no-audit --progress=false --arch=${TARGET_ARCH} --platform=${TARGET_PLATFORM} install
24+
25+
# --- START TEMPORARY DEBUG STEP ---
26+
# Check if the specific .node file exists after install
27+
RUN echo ">>> Checking for .node file presence for ${TARGET_PLATFORM}-${TARGET_ARCH}..." && \
28+
NODE_FILE_PATH="/build/node_modules/sharp/build/Release/sharp-${TARGET_PLATFORM}-${TARGET_ARCH}.node" && \
29+
if [ -f "$NODE_FILE_PATH" ]; then \
30+
echo ">>> SUCCESS: Found file:"; \
31+
ls -l "$NODE_FILE_PATH"; \
32+
else \
33+
echo ">>> FAILURE: File NOT found at $NODE_FILE_PATH!"; \
34+
echo ">>> Listing /build/node_modules/sharp/build/Release contents:"; \
35+
ls -l /build/node_modules/sharp/build/Release/; \
36+
echo ">>> Listing /build/node_modules/sharp/vendor contents (if exists):"; \
37+
ls -lR /build/node_modules/sharp/vendor/; \
38+
exit 1; \ # Optionally fail fast if file not found
39+
fi
40+
# --- END TEMPORARY DEBUG STEP ---
41+
2242

2343
# Run webpack, passing the TARGET_ARCH environment variable
2444
# Webpack config will use this to create arch-specific output
2545
RUN TARGET_ARCH=${TARGET_ARCH} node ./node_modules/webpack/bin/webpack.js
2646

2747
# Simple test to ensure sharp loads correctly for the target architecture
28-
RUN node -e "console.log(require('sharp')('./package.json'))"
48+
# Note: This might fail now if webpack failed, run it only after successful webpack
49+
# RUN node -e "console.log(require('sharp')('./package.json'))"
2950

30-
# No entrypoint needed - we will copy the file out using 'docker run -v' or 'docker cp'
31-
# The final ZIP file is now expected to be in /build/dist/sharp-layer-${TARGET_ARCH}.zip
32-
# based on the updated webpack config.
51+
# No entrypoint needed

0 commit comments

Comments
 (0)