Skip to content

Commit dbbdb7e

Browse files
committed
feat: update docker build logic in cli app and turn off runtime build for the cli app
1 parent 2febb2a commit dbbdb7e

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

adminforth/commands/createApp/templates/Dockerfile.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ ADD package.json {{dockerAdditionalManifestFiles}} /code/
55
RUN {{packageManager}} {{dockerPackageInstallSubcommand}}
66
ADD . /code/
77
RUN {{packageManagerExec}} adminforth bundle
8+
RUN {{ packageManager }} run build
89
CMD ["sh", "-c", "{{packageManagerRun}} migrate:prod && {{packageManagerRun}} prod"]

adminforth/commands/createApp/templates/index.ts.hbs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,11 @@ if (fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) {
7575

7676
const port = 3500;
7777

78-
admin.bundleNow({ hotReload: process.env.NODE_ENV === 'development' }).then(() => {
79-
logger.info('Bundling AdminForth SPA done.');
80-
});
78+
if (process.env.NODE_ENV === 'development') {
79+
admin.bundleNow({ hotReload: true }).then(() => {
80+
logger.info('Bundling AdminForth SPA done.');
81+
});
82+
}
8183

8284
admin.express.serve(app);
8385

adminforth/commands/createApp/templates/package.json.hbs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"description": "",
1010
"scripts": {
1111
"dev": "{{packageManagerEnvDev}} tsx watch index.ts",
12-
"prod": "{{packageManagerEnvProd}} tsx index.ts",
12+
"build": "{{packageManagerEnvProd}} tsup index.ts --format esm --clean",
13+
"prod": "{{packageManagerEnvProd}} node dist/index.js",
1314
"start": "{{packageManagerRun}} dev",
1415
{{#if includePrismaMigrations}}
1516
"makemigration": "{{packageManagerEnvDev}} npx --yes prisma migrate dev --create-only",
@@ -30,6 +31,7 @@
3031
},
3132
"devDependencies": {
3233
"typescript": "6.0.3",
34+
"tsup": "^8.5.1",
3335
"tsx": "4.11.2",
3436
"@types/express": "^4.17.21",
3537
"@types/node": "latest",

0 commit comments

Comments
 (0)