Skip to content

Commit

Permalink
H-3845: Fix Docker set up for Yarn 4 + Node 22 (#5973)
Browse files Browse the repository at this point in the history
  • Loading branch information
CiaranMn committed Jan 13, 2025
1 parent 0daf783 commit 5eba135
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 14 deletions.
17 changes: 12 additions & 5 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 10 additions & 3 deletions apps/hash-ai-worker-ts/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 && \
Expand Down
13 changes: 10 additions & 3 deletions apps/hash-integration-worker/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 10 additions & 3 deletions infra/docker/api/prod/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
install -d -m 0775 -o api -g hash /log

USER api:hash
Expand Down

0 comments on commit 5eba135

Please sign in to comment.