From 4f55c31a003e5b4917098fd733ba8f8f1ffb9907 Mon Sep 17 00:00:00 2001 From: Ciaran Morinan Date: Thu, 19 Dec 2024 09:15:45 +0000 Subject: [PATCH 1/2] dockerfile fixes for node22 + yarn 4 --- .env | 17 ++++++++++++----- apps/hash-ai-worker-ts/docker/Dockerfile | 13 ++++++++++--- apps/hash-integration-worker/docker/Dockerfile | 13 ++++++++++--- infra/docker/api/prod/Dockerfile | 15 +++++++++++---- 4 files changed, 43 insertions(+), 15 deletions(-) diff --git a/.env b/.env index c8c770b5c88..c709817ec19 100644 --- a/.env +++ b/.env @@ -110,12 +110,19 @@ HASH_TELEMETRY_DESTINATION=REPLACE_ME.aws.com # Is used for differentiating different apps, can be any value HASH_TELEMETRY_APP_ID=hash-app +########################################### # Disable telemetry from third-party dependencies who transmit IP addresses -NEXT_TELEMETRY_DISABLED=1 # Vercel Next.js -TURBO_TELEMETRY_DISABLED=1 # Vercel Turborepo -YARN_ENABLE_TELEMETRY=0 # Yarn -ARTILLERY_DISABLE_TELEMETRY=true # Artillery -CHECKPOINT_DISABLE=1 # Terraform and others +########################################### +# Vercel Next.js +NEXT_TELEMETRY_DISABLED=1 +# Vercel Turborepo +TURBO_TELEMETRY_DISABLED=1 +# Yarn +YARN_ENABLE_TELEMETRY=0 +# Artillery +ARTILLERY_DISABLE_TELEMETRY=true +# Terraform and others +CHECKPOINT_DISABLE=1 ########################################### ## Aliases for dockerized external services diff --git a/apps/hash-ai-worker-ts/docker/Dockerfile b/apps/hash-ai-worker-ts/docker/Dockerfile index b82cf439cd4..d5b423e0f69 100644 --- a/apps/hash-ai-worker-ts/docker/Dockerfile +++ b/apps/hash-ai-worker-ts/docker/Dockerfile @@ -57,7 +57,16 @@ FROM node:22.12-slim AS runner COPY --from=installer /usr/local/src /usr/local/src WORKDIR /usr/local/src/apps/hash-ai-worker-ts -ENTRYPOINT [ "yarn", "--cache-folder", "/tmp/yarn-cache", "--global-folder", "/tmp/yarn-global" ] +RUN groupadd --system --gid 60000 hash && \ + useradd --system tsworker -G hash + +# Set a writable Corepack cache directory +ENV COREPACK_HOME=/usr/local/src/var/corepack-cache +RUN mkdir -p $COREPACK_HOME && \ + chown tsworker:hash $COREPACK_HOME && \ + corepack enable && corepack prepare --activate + +ENTRYPOINT [ "yarn"] CMD ["start"] ARG GOOGLE_CLOUD_WORKLOAD_IDENTITY_FEDERATION_CONFIG_JSON @@ -74,8 +83,6 @@ RUN if [ -n "$GOOGLE_CLOUD_WORKLOAD_IDENTITY_FEDERATION_CONFIG_JSON" ]; then \ RUN apt-get update && \ apt-get install -y --no-install-recommends curl && \ rm -rf /var/lib/apt/lists/* && \ - groupadd --system --gid 60000 hash && \ - useradd --system tsworker -G hash && \ install -d -m 0775 -o tsworker -g hash /log RUN mkdir -p officeParserTemp/tempfiles && \ diff --git a/apps/hash-integration-worker/docker/Dockerfile b/apps/hash-integration-worker/docker/Dockerfile index 6d9eff596b2..d060b957b1c 100644 --- a/apps/hash-integration-worker/docker/Dockerfile +++ b/apps/hash-integration-worker/docker/Dockerfile @@ -57,14 +57,21 @@ FROM node:22.12-slim AS runner COPY --from=installer /usr/local/src /usr/local/src WORKDIR /usr/local/src/apps/hash-integration-worker -ENTRYPOINT [ "yarn", "--cache-folder", "/tmp/yarn-cache", "--global-folder", "/tmp/yarn-global" ] +RUN groupadd --system --gid 60000 hash && \ + useradd --system integrationworker -G hash + +# Set a writable Corepack cache directory +ENV COREPACK_HOME=/usr/local/src/var/corepack-cache +RUN mkdir -p $COREPACK_HOME && \ + chown integrationworker:hash $COREPACK_HOME && \ + corepack enable && corepack prepare --activate + +ENTRYPOINT [ "yarn"] CMD ["start"] RUN apt-get update && \ apt-get install -y --no-install-recommends curl && \ rm -rf /var/lib/apt/lists/* && \ - groupadd --system --gid 60000 hash && \ - useradd --system integrationworker -G hash && \ install -d -m 0775 -o integrationworker -g hash /log USER integrationworker:hash diff --git a/infra/docker/api/prod/Dockerfile b/infra/docker/api/prod/Dockerfile index d6861667aac..bf8fa1be67d 100644 --- a/infra/docker/api/prod/Dockerfile +++ b/infra/docker/api/prod/Dockerfile @@ -58,14 +58,21 @@ COPY --from=installer /usr/local/src /usr/local/src WORKDIR /usr/local/src/apps/hash-api RUN mkdir -p /usr/local/src/var/uploads -ENTRYPOINT [ "yarn", "--cache-folder", "/tmp/yarn-cache", "--global-folder", "/tmp/yarn-global" ] +RUN groupadd --system --gid 60000 hash && \ + useradd --system api -G hash + +# Set a writable Corepack cache directory +ENV COREPACK_HOME=/usr/local/src/var/corepack-cache +RUN mkdir -p $COREPACK_HOME && \ + chown api:hash $COREPACK_HOME && \ + corepack enable && corepack prepare --activate + +ENTRYPOINT [ "yarn"] CMD ["start"] RUN apt-get update && \ apt-get install -y --no-install-recommends curl && \ - rm -rf /var/lib/apt/lists/* && \ - groupadd --system --gid 60000 hash && \ - useradd --system api -G hash && \ + rm -rf /var/lib/apt/lists/* && \ install -d -m 0775 -o api -g hash /log USER api:hash From 708d83c288ae1e69f64a885f564cd76fc198d15a Mon Sep 17 00:00:00 2001 From: Ciaran Morinan Date: Thu, 19 Dec 2024 09:20:03 +0000 Subject: [PATCH 2/2] remove stray whitespace --- infra/docker/api/prod/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infra/docker/api/prod/Dockerfile b/infra/docker/api/prod/Dockerfile index bf8fa1be67d..aee7c1e9c06 100644 --- a/infra/docker/api/prod/Dockerfile +++ b/infra/docker/api/prod/Dockerfile @@ -72,7 +72,7 @@ CMD ["start"] RUN apt-get update && \ apt-get install -y --no-install-recommends curl && \ - rm -rf /var/lib/apt/lists/* && \ + rm -rf /var/lib/apt/lists/* && \ install -d -m 0775 -o api -g hash /log USER api:hash