From d1871a4a644c191da4f83147aa88d3878700cfe7 Mon Sep 17 00:00:00 2001 From: "Quentin G." Date: Sat, 14 Sep 2024 11:05:01 +0200 Subject: [PATCH] feat: replace ts-node with tsx and pre-install it globaly in docker (#7027) Implement https://github.com/twentyhq/twenty/issues/5976 suggestion. It leads to faster boot time since we don't have to install dependencies. It should also solve https://github.com/twentyhq/twenty/issues/4772 as we don't need to run ressource-heavy `npm install` (the mentioned migration step does not seem to exist anymore anyway. --- packages/twenty-docker/twenty/Dockerfile | 2 ++ packages/twenty-docker/twenty/entrypoint.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/twenty-docker/twenty/Dockerfile b/packages/twenty-docker/twenty/Dockerfile index ee0b05215..e57cf30d1 100644 --- a/packages/twenty-docker/twenty/Dockerfile +++ b/packages/twenty-docker/twenty/Dockerfile @@ -50,6 +50,8 @@ FROM node:18.17.1-alpine as twenty # Used to run healthcheck in docker RUN apk add --no-cache curl jq +RUN npm install -g tsx + COPY ./packages/twenty-docker/twenty/entrypoint.sh /app/entrypoint.sh RUN chmod +x /app/entrypoint.sh diff --git a/packages/twenty-docker/twenty/entrypoint.sh b/packages/twenty-docker/twenty/entrypoint.sh index 17adc8952..9733781fd 100755 --- a/packages/twenty-docker/twenty/entrypoint.sh +++ b/packages/twenty-docker/twenty/entrypoint.sh @@ -5,7 +5,7 @@ if [ "${ENABLE_DB_MIGRATIONS}" = "true" ] && [ ! -f /app/docker-data/db_status ] echo "Running database setup and migrations..." # Run setup and migration scripts - NODE_OPTIONS="--max-old-space-size=1500" npx ts-node ./scripts/setup-db.ts + NODE_OPTIONS="--max-old-space-size=1500" tsx ./scripts/setup-db.ts yarn database:migrate:prod # Mark initialization as done