From 87265364fd1978acccf70622860f8a1ab433a3b2 Mon Sep 17 00:00:00 2001 From: Aaron Knudtson <87577305+knudtty@users.noreply.github.com> Date: Mon, 23 Nov 2026 13:08:18 -0500 Subject: [PATCH 1/4] fix: pick up Alpine security fixes in the HyperDX image and drop unused package Dockerfiles Run apk upgrade in the prod and all-in-one stages so OpenSSL (3.5.9-r1) and zlib (1.4-r0) fixes land without waiting for new Node and ClickHouse base images. Remove packages/app/Dockerfile and packages/api/Dockerfile: no compose file, Makefile target or workflow has built them since dev moved off them in #567. --- .changeset/image-apk-upgrade.md | 7 ++ docker/hyperdx/Dockerfile | 14 ++-- packages/api/Dockerfile | 86 ------------------------ packages/app/Dockerfile | 115 -------------------------------- 4 files changed, 16 insertions(+), 206 deletions(-) create mode 100644 .changeset/image-apk-upgrade.md delete mode 100644 packages/api/Dockerfile delete mode 100644 packages/app/Dockerfile diff --git a/.changeset/image-apk-upgrade.md b/.changeset/image-apk-upgrade.md new file mode 100644 index 000000000..d72049ff4 --- /dev/null +++ b/.changeset/image-apk-upgrade.md @@ -0,0 +1,7 @@ +--- +'@hyperdx/api': patch +'@hyperdx/app': patch +--- + +fix: run `apk upgrade` in the HyperDX image so it picks up Alpine security fixes +(OpenSSL, zlib) released after the Node and ClickHouse base images were built. diff --git a/docker/hyperdx/Dockerfile b/docker/hyperdx/Dockerfile index 4c80ac6d8..d42721610 100644 --- a/docker/hyperdx/Dockerfile +++ b/docker/hyperdx/Dockerfile @@ -7,7 +7,7 @@ # - Mongo # - Otel Collector (otelcol) -ARG NODE_VERSION=22.23.4 +ARG NODE_VERSION=22.23.5 ARG CLICKHOUSE_VERSION=26.10.3.7 ARG OTEL_COLLECTOR_VERSION=0.165.0 ARG OTEL_COLLECTOR_CORE_VERSION=1.71.0 @@ -125,8 +125,10 @@ ENV OTEL_RESOURCE_ATTRIBUTES="service.version=$CODE_VERSION" ENV OTEL_SERVICE_NAME=hdx-oss-app ENV NODE_ENV=production -# Remove package managers from production image (not needed at runtime) -RUN rm -rf /usr/local/lib/node_modules/npm /usr/local/lib/node_modules/corepack \ +# Pick up Alpine security fixes newer than the base image, then remove package +# managers from production image (not needed at runtime) +RUN apk upgrade --no-cache && \ + rm -rf /usr/local/lib/node_modules/npm /usr/local/lib/node_modules/corepack \ /usr/local/bin/npm /usr/local/bin/npx /usr/local/bin/corepack \ /usr/local/bin/yarn /usr/local/bin/yarnpkg @@ -200,8 +202,10 @@ COPY --from=migrate-builder /migrate /usr/local/bin/migrate # Install MongoDB and other dependencies (consolidated into a single RUN command). # libstdc++/libgcc are the Node.js runtime deps, installed before the v3.9 -# repositories are appended so they resolve from this image's own Alpine release. -RUN apk add --no-cache libstdc++ libgcc && \ +# repositories are appended so they resolve from this image's own Alpine release, +# as does the upgrade that picks up security fixes newer than the base image. +RUN apk upgrade --no-cache && \ + apk add --no-cache libstdc++ libgcc && \ echo 'http://dl-cdn.alpinelinux.org/alpine/v3.9/main' >> /etc/apk/repositories && \ echo 'http://dl-cdn.alpinelinux.org/alpine/v3.9/community' >> /etc/apk/repositories && \ apk update && \ diff --git a/packages/api/Dockerfile b/packages/api/Dockerfile deleted file mode 100644 index 31a23cc9b..000000000 --- a/packages/api/Dockerfile +++ /dev/null @@ -1,86 +0,0 @@ -## base ############################################################################################# -FROM node:22.23.4-alpine AS base - -WORKDIR /app - -COPY .yarn ./.yarn -COPY .yarnrc.yml yarn.lock package.json nx.json .oxfmtrc.json ./tsconfig.base.json ./ -# Only copy package.json for workspace resolution during yarn install; -# full source is copied in the build stages that need it. -COPY ./packages/common-utils/package.json ./packages/common-utils/package.json -COPY ./packages/api/jest.config.js ./packages/api/tsconfig.json ./packages/api/tsconfig.build.json ./packages/api/package.json ./packages/api/ -COPY ./packages/api/bin ./packages/api/bin -# Use BuildKit cache mount to persist Yarn download cache across builds, -# so unchanged packages aren't re-downloaded even when yarn.lock changes. -RUN --mount=type=cache,target=/root/.yarn/berry/cache,id=yarn-cache \ - yarn install --mode=skip-build && yarn cache clean - - -## dev ############################################################################################# - -FROM base AS dev - -COPY ./packages/common-utils ./packages/common-utils - -EXPOSE 8000 - -ENTRYPOINT ["npx", "nx", "run", "@hyperdx/api:dev"] - - -## common-utils-builder ############################################################################ -# Separate stage so common-utils build is cached independently of API source changes. - -FROM base AS common-utils-builder - -COPY ./packages/common-utils ./packages/common-utils -RUN yarn workspace @hyperdx/common-utils run build - - -## builder ######################################################################################### - -FROM base AS builder - -# Copy pre-built common-utils from its dedicated build stage -COPY --from=common-utils-builder /app/packages/common-utils ./packages/common-utils - -COPY ./packages/api/src ./packages/api/src -RUN yarn workspace @hyperdx/api run build -RUN --mount=type=cache,target=/root/.yarn/berry/cache,id=yarn-cache \ - rm -rf node_modules && yarn workspaces focus @hyperdx/api --production - - -## prod ############################################################################################ - -FROM node:22.23.4-alpine AS prod - -LABEL org.opencontainers.image.vendor="HyperDX" \ - org.opencontainers.image.title="HyperDX API" \ - org.opencontainers.image.description="HyperDX API service for observability platform" \ - org.opencontainers.image.source="https://github.com/ClickHouse/ClickStack" \ - org.opencontainers.image.licenses="MIT" - -ARG CODE_VERSION - -ENV CODE_VERSION=$CODE_VERSION -ENV OTEL_RESOURCE_ATTRIBUTES="service.version=$CODE_VERSION" -ENV NODE_ENV production - -ARG PORT - -ENV PORT=$PORT - -EXPOSE ${PORT} - -USER node - -WORKDIR /app - -COPY --chown=node:node --from=builder /app/node_modules ./node_modules -COPY --chown=node:node --from=builder /app/packages/api/build ./packages/api/build -COPY --chown=node:node --from=builder /app/packages/api/bin ./packages/api/bin -COPY --chown=node:node --from=builder /app/packages/common-utils/dist ./packages/common-utils/dist - -HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \ - CMD node -e "require('http').get('http://localhost:'+(process.env.PORT||8000)+'/health',r=>r.statusCode===200?process.exit(0):process.exit(1)).on('error',()=>process.exit(1))" - -ENTRYPOINT ["./packages/api/bin/hyperdx", "api"] diff --git a/packages/app/Dockerfile b/packages/app/Dockerfile deleted file mode 100644 index 5c9ac9a19..000000000 --- a/packages/app/Dockerfile +++ /dev/null @@ -1,115 +0,0 @@ -## base ############################################################################################# -FROM node:22.23.4-alpine AS base -# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. -RUN apk add --no-cache libc6-compat -WORKDIR /app - -COPY .yarn ./.yarn -COPY .yarnrc.yml yarn.lock package.json nx.json .oxfmtrc.json ./tsconfig.base.json ./ -# Only copy package.json for workspace resolution during yarn install; -# full source is copied in the build stages that need it. -COPY ./packages/common-utils/package.json ./packages/common-utils/package.json -COPY ./packages/app/jest.config.js ./packages/app/tsconfig.json ./packages/app/tsconfig.build.json ./packages/app/package.json ./packages/app/next.config.mjs ./packages/app/mdx.d.ts ./packages/app/css.d.ts ./packages/app/ -RUN --mount=type=cache,target=/root/.yarn/berry/cache,id=yarn-cache \ - yarn install --mode=skip-build && yarn cache clean - - -## dev ############################################################################################# -FROM base AS dev - -COPY ./packages/common-utils ./packages/common-utils - -EXPOSE 8080 - -ENTRYPOINT ["npx", "nx", "run", "@hyperdx/app:dev"] - - -## common-utils-builder ############################################################################ -# Separate stage so common-utils build is cached independently of App source changes. - -FROM base AS common-utils-builder - -COPY ./packages/common-utils ./packages/common-utils -RUN yarn workspace @hyperdx/common-utils run build - - -## builder ######################################################################################### -# Rebuild the source code only when needed -FROM base AS builder - -# Copy pre-built common-utils from its dedicated build stage -COPY --from=common-utils-builder /app/packages/common-utils ./packages/common-utils - -# Expose custom env variables to the browser (needs NEXT_PUBLIC_ prefix) -# doc: https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables#bundling-environment-variables-for-the-browser -ARG OTEL_EXPORTER_OTLP_ENDPOINT -ARG OTEL_EXPORTER_OTLP_TRACES_ENDPOINT -ARG OTEL_EXPORTER_OTLP_METRICS_ENDPOINT -ARG OTEL_EXPORTER_OTLP_LOGS_ENDPOINT -ARG OTEL_SERVICE_NAME -ARG IS_LOCAL_MODE -ENV NEXT_PUBLIC_OTEL_EXPORTER_OTLP_ENDPOINT $OTEL_EXPORTER_OTLP_ENDPOINT -ENV NEXT_PUBLIC_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT $OTEL_EXPORTER_OTLP_TRACES_ENDPOINT -ENV NEXT_PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT $OTEL_EXPORTER_OTLP_METRICS_ENDPOINT -ENV NEXT_PUBLIC_OTEL_EXPORTER_OTLP_LOGS_ENDPOINT $OTEL_EXPORTER_OTLP_LOGS_ENDPOINT -ENV NEXT_PUBLIC_OTEL_SERVICE_NAME $OTEL_SERVICE_NAME -ENV NEXT_PUBLIC_IS_LOCAL_MODE $IS_LOCAL_MODE - -COPY ./packages/app/src ./packages/app/src -COPY ./packages/app/pages ./packages/app/pages -COPY ./packages/app/public ./packages/app/public -COPY ./packages/app/styles ./packages/app/styles -COPY ./packages/app/types ./packages/app/types -# next build finds instrumentation.ts only next to pages/, not under src/ -COPY ./packages/app/instrumentation.ts ./packages/app/instrumentation-client.ts ./packages/app/ -# Build inputs for public/whats-new.json, generated by next.config.mjs for the -# in-app "What's new" section: the root changelog it parses (next.config resolves -# it as /app/packages/app/../../CHANGELOG.md) and the parser itself. The build -# fails loudly if either is missing (see next.config.mjs). -COPY ./CHANGELOG.md ./CHANGELOG.md -COPY ./packages/app/scripts ./packages/app/scripts -RUN yarn workspace @hyperdx/app run build -RUN --mount=type=cache,target=/root/.yarn/berry/cache,id=yarn-cache \ - rm -rf node_modules && yarn workspaces focus @hyperdx/app --production - - -## prod ############################################################################################ -FROM node:22.23.4-alpine AS prod - -LABEL org.opencontainers.image.vendor="HyperDX" \ - org.opencontainers.image.title="HyperDX App" \ - org.opencontainers.image.description="HyperDX frontend application for observability platform" \ - org.opencontainers.image.source="https://github.com/ClickHouse/ClickStack" \ - org.opencontainers.image.licenses="MIT" - -WORKDIR /app - -ENV NODE_ENV production - -RUN addgroup -g 1001 -S nodejs -RUN adduser -S nextjs -u 1001 - -# You only need to copy next.config.mjs if you are NOT using the default configuration -COPY --from=builder /app/packages/app/next.config.mjs ./ -COPY --from=builder --chown=nextjs:nodejs /app/packages/app/public ./public -COPY --from=builder --chown=nextjs:nodejs /app/packages/app/.next ./.next -COPY --from=builder /app/node_modules ./node_modules -COPY --from=builder /app/packages/app/package.json ./package.json - -USER nextjs - -ARG PORT - -ENV PORT=$PORT - -EXPOSE ${PORT} - -# Next.js collects completely anonymous telemetry data about general usage. -# Learn more here: https://nextjs.org/telemetry -# Uncomment the following line in case you want to disable telemetry. -ENV NEXT_TELEMETRY_DISABLED 1 - -HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \ - CMD node -e "require('http').get('http://localhost:'+(process.env.PORT||8080)+'/api/health',r=>r.statusCode===200?process.exit(0):process.exit(1)).on('error',()=>process.exit(1))" - -CMD ["sh", "-c", "node_modules/.bin/next start -p ${PORT}"] From 7ea60a651a18f8abd1fc4fa9083e354b5b54f1d2 Mon Sep 17 00:00:00 2001 From: Aaron Knudtson <87577305+knudtty@users.noreply.github.com> Date: Mon, 23 Nov 2026 14:35:51 -0500 Subject: [PATCH 2/4] chore: bump .nvmrc to Node 22.23.5 to match the image The HyperDX image moved to node:22.23.5-alpine; keep CI, tests and the release bootstrap (node-version-file: .nvmrc) on the same version. --- .changeset/image-apk-upgrade.md | 3 ++- .nvmrc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.changeset/image-apk-upgrade.md b/.changeset/image-apk-upgrade.md index d72049ff4..e167f5b6c 100644 --- a/.changeset/image-apk-upgrade.md +++ b/.changeset/image-apk-upgrade.md @@ -4,4 +4,5 @@ --- fix: run `apk upgrade` in the HyperDX image so it picks up Alpine security fixes -(OpenSSL, zlib) released after the Node and ClickHouse base images were built. +(OpenSSL, zlib) released after the Node and ClickHouse base images were built, +and bump Node from 22.23.4 to 22.23.5 in the image and `.nvmrc`. diff --git a/.nvmrc b/.nvmrc index c62d2c858..fb6111a48 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -22.23.4 \ No newline at end of file +22.23.5 From a7007f84cf427558c6bffa294ad6bc90ada5eac2 Mon Sep 17 00:00:00 2001 From: Aaron Knudtson <87577305+knudtty@users.noreply.github.com> Date: Mon, 23 Nov 2026 14:40:50 -0500 Subject: [PATCH 3/4] ci: skip the build cache for the apk upgrade stages in nightly images Nightly builds pass a constant CODE_VERSION (2-nightly), so the cached apk upgrade layer was reused until the base image moved. Release builds already re-run it: their CODE_VERSION ENV changes every release and sits above the upgrade. --- .github/workflows/release-nightly.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/release-nightly.yml b/.github/workflows/release-nightly.yml index 084a670e7..955ef2675 100644 --- a/.github/workflows/release-nightly.yml +++ b/.github/workflows/release-nightly.yml @@ -121,6 +121,9 @@ jobs: file: ./docker/hyperdx/Dockerfile platforms: ${{ matrix.platform }} target: prod + # CODE_VERSION is constant for nightly, so without this the cached + # `apk upgrade` layer would be reused until the base image moves. + no-cache-filters: prod build-contexts: | hyperdx=./docker/hyperdx api=./packages/api @@ -198,6 +201,7 @@ jobs: file: ./docker/hyperdx/Dockerfile platforms: ${{ matrix.platform }} target: all-in-one-noauth + no-cache-filters: all-in-one-base build-contexts: | clickhouse=./docker/clickhouse otel-collector=./docker/otel-collector @@ -277,6 +281,7 @@ jobs: file: ./docker/hyperdx/Dockerfile platforms: ${{ matrix.platform }} target: all-in-one-auth + no-cache-filters: all-in-one-base build-contexts: | clickhouse=./docker/clickhouse otel-collector=./docker/otel-collector From aa4991840894e66f7bf8c57359c172387c46a523 Mon Sep 17 00:00:00 2001 From: Aaron Knudtson <87577305+knudtty@users.noreply.github.com> Date: Mon, 23 Nov 2026 15:04:10 -0500 Subject: [PATCH 4/4] ci: keep the build cache for nightly all-in-one images all-in-one-base also installs mongodb from the archived Alpine v3.9 repo; skipping its cache made that mirror a daily dependency of the nightly build. Release builds still re-run the upgrade on every version. --- .github/workflows/release-nightly.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-nightly.yml b/.github/workflows/release-nightly.yml index 955ef2675..30e6b5fcf 100644 --- a/.github/workflows/release-nightly.yml +++ b/.github/workflows/release-nightly.yml @@ -122,7 +122,9 @@ jobs: platforms: ${{ matrix.platform }} target: prod # CODE_VERSION is constant for nightly, so without this the cached - # `apk upgrade` layer would be reused until the base image moves. + # `apk upgrade` layer would be reused until the base image moves. Not + # set on the all-in-one builds: that stage also installs mongodb from + # the archived Alpine v3.9 repo, which shouldn't be a daily dependency. no-cache-filters: prod build-contexts: | hyperdx=./docker/hyperdx @@ -201,7 +203,6 @@ jobs: file: ./docker/hyperdx/Dockerfile platforms: ${{ matrix.platform }} target: all-in-one-noauth - no-cache-filters: all-in-one-base build-contexts: | clickhouse=./docker/clickhouse otel-collector=./docker/otel-collector @@ -281,7 +282,6 @@ jobs: file: ./docker/hyperdx/Dockerfile platforms: ${{ matrix.platform }} target: all-in-one-auth - no-cache-filters: all-in-one-base build-contexts: | clickhouse=./docker/clickhouse otel-collector=./docker/otel-collector