@@ -26,25 +26,25 @@ RUN TARGET_ARCH=${TARGET_ARCH} node ./node_modules/webpack/bin/webpack.js
2626
2727# --- Smoke Test ---
2828RUN echo ">>> Running smoke test on packaged layer..." && \
29- node -e " \
30- try { \
31- /* --- HARDCODE Correct path relative to /build/dist --- */ \
32- const sharp = require('/build/dist/nodejs/node_modules/sharp'); \
33- console.log('>>> SUCCESS: require(\' sharp\' ) loaded.'); \
34- /* Check for versions property existence before accessing */ \
35- if (sharp && sharp.versions) { \
29+ # Try to execute the node command in a subshell group ()
30+ ( \
31+ node -e " \
32+ const sharp = require('/build/dist/nodejs/node_modules/sharp'); \
33+ console.log('>>> SUCCESS: require(\' sharp\' ) loaded.'); \
34+ if (sharp && sharp.versions) { \
3635 console.log('Sharp versions:', sharp.versions); \
37- } else { \
36+ } else { \
3837 console.log('Sharp loaded, but versions property not found.'); \
39- } \
40- } catch (err) { \
41- console.error('>>> FAILURE: require(\' sharp\' ) failed:', err); \
42- /* Add more debug info on failure */ \
43- console.error('Listing /build/dist/nodejs/node_modules/sharp contents on failure:'); \
44- ls -lR /build/dist/nodejs/node_modules/sharp || echo 'Failed to list contents.'; \
45- exit 1; \
46- } \
47- "
38+ } \
39+ " \
40+ ) || \
41+ # If the node command fails (exits non-zero), execute this block
42+ ( \
43+ echo ">>> FAILURE: Node smoke test failed!" && \
44+ echo ">>> Listing /build/dist/nodejs/node_modules/sharp contents on failure:" && \
45+ ls -lR /build/dist/nodejs/node_modules/sharp && \
46+ exit 1 \
47+ )
4848# --- End Smoke Test ---
4949
5050# Simple test to ensure sharp loads correctly for the target architecture
0 commit comments