diff --git a/Dockerfile b/Dockerfile index 7eeb2ac..055a4ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,15 @@ ENV HOSTNAME=0.0.0.0 # Copy the standalone build artifact (server.js, .next/, public/) COPY build /app +# The standalone build was created on macOS (darwin-arm64), so it bundles +# macOS-only native binaries for sharp (image optimisation). These crash +# on Linux/Alpine. Replace them with the correct musl-linux-x64 binaries. +RUN rm -rf node_modules/@img/sharp-darwin-arm64 \ + node_modules/@img/sharp-libvips-darwin-arm64 && \ + npm install --no-save --platform=linuxmusl --arch=x64 \ + @img/sharp-linuxmusl-x64@0.34.5 && \ + rm -rf /tmp/* /root/.npm + EXPOSE 3000 CMD ["node", "server.js"]