From 25d087a54b396d929c36e35b3993088ca5ce72a0 Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Mon, 13 May 2024 11:54:51 -1000 Subject: [PATCH] feat(build): :sparkles: Start Lysand from CLI in prod --- Dockerfile | 2 +- cli/commands/start.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 94bbb3fd..ec5ddd6d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,4 +47,4 @@ WORKDIR /app ENV NODE_ENV=production ENTRYPOINT [ "/bin/sh", "/app/entrypoint.sh" ] # Run migrations and start the server -CMD [ "start" ] +CMD [ "cli", "start" ] diff --git a/cli/commands/start.ts b/cli/commands/start.ts index 027a6d68..79c16f75 100644 --- a/cli/commands/start.ts +++ b/cli/commands/start.ts @@ -35,8 +35,13 @@ export default class Start extends BaseCommand { const numCPUs = flags["all-threads"] ? os.cpus().length : flags.threads; + // Check if index is a JS or TS file (depending on the environment) + const index = (await Bun.file("index.ts").exists()) + ? "index.ts" + : "index.js"; + for (let i = 0; i < numCPUs; i++) { - const args = ["bun", "index.ts"]; + const args = ["bun", index]; if (i !== 0 || flags.silent) { args.push("--silent"); }