Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

nodejs and npm come from the node image, apk can not pin a nodejs version reliably (#6583)

Cenk Kücük0e5b8b516f1f
diff --git a/Dockerfile b/Dockerfile
index 9396f8f35a..ce55e35549 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,6 +2,9 @@
# platform specific, it makes sense to build it in the docker
+#### Node
+FROM node:24.17.0-alpine3.23@sha256:7c70d1235c0b4c2bc9eeed5393d19f1bbdde6885ba0d58ba62bb385d7b0f3ff1 AS nodejs
+
#### Builder
FROM hexpm/elixir:1.20.2-erlang-28.5.0.3-alpine-3.23.5@sha256:6f03034e254126f063959873d8d3b811ee92abaabab27b62c53982c4a1034e39 AS buildcontainer
@@ -21,7 +24,13 @@ RUN mkdir /app
WORKDIR /app
# install build dependencies
-RUN apk add --no-cache git "nodejs=24.17.0-r0" yarn npm python3 ca-certificates wget gnupg make gcc libc-dev brotli
+RUN apk add --no-cache git python3 ca-certificates wget gnupg make gcc libc-dev brotli
+
+# nodejs and npm come from the node image, apk can not pin a nodejs version reliably
+COPY --from=nodejs /usr/local/bin/node /usr/local/bin/node
+COPY --from=nodejs /usr/local/lib/node_modules/npm /usr/local/lib/node_modules/npm
+RUN ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \
+ ln -s ../lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx
COPY mix.exs ./
COPY mix.lock ./