1
1
import process from 'node:process'
2
- import { log , runCommand } from '@stacksjs/cli'
2
+ import { log } from '@stacksjs/cli'
3
3
import { app } from '@stacksjs/config'
4
4
import { frameworkCloudPath , frameworkPath , projectPath } from '@stacksjs/path'
5
5
import { hasFiles } from '@stacksjs/storage'
@@ -8,8 +8,11 @@ import { $ } from 'bun'
8
8
9
9
export async function cleanCopy ( sourcePath : string , targetPath : string ) {
10
10
$ . cwd ( frameworkPath ( 'server' ) )
11
+ log . debug ( `Deleting ${ targetPath } ...` )
11
12
await $ `rm -rf ${ targetPath } ` . text ( )
13
+ log . debug ( `Copying ${ sourcePath } to ${ targetPath } ...` )
12
14
await $ `cp -r ${ sourcePath } ${ targetPath } ` . text ( )
15
+ log . debug ( `Done copying ${ sourcePath } to ${ targetPath } ` )
13
16
}
14
17
15
18
export async function useCustomOrDefaultServerConfig ( ) {
@@ -29,10 +32,14 @@ export async function buildDockerImage() {
29
32
log . info ( 'Preparing build...' )
30
33
31
34
// delete old CDK relating files, to always build fresh
32
- await $ `rm -rf ${ frameworkCloudPath ( 'cdk.out/' ) } `
33
- await $ `rm -rf ${ frameworkCloudPath ( 'cdk.context.json' ) } `
34
- await $ `rm -rf ${ frameworkCloudPath ( 'dist.zip' ) } `
35
+ log . debug ( 'Deleting old CDK files...' )
36
+ await $ `rm -rf ${ frameworkCloudPath ( 'cdk.out/' ) } ` . text ( )
37
+ log . debug ( 'Deleting old CDK context file...' )
38
+ await $ `rm -rf ${ frameworkCloudPath ( 'cdk.context.json' ) } ` . text ( )
39
+ log . debug ( 'Deleting old dist.zip file...' )
40
+ await $ `rm -rf ${ frameworkCloudPath ( 'dist.zip' ) } ` . text ( )
35
41
42
+ log . info ( 'Copying project files...' )
36
43
await cleanCopy ( projectPath ( 'config' ) , frameworkPath ( 'server/config' ) )
37
44
await cleanCopy ( projectPath ( 'routes' ) , frameworkPath ( 'server/routes' ) )
38
45
await cleanCopy ( projectPath ( 'app' ) , frameworkPath ( 'server/app' ) )
@@ -45,7 +52,8 @@ export async function buildDockerImage() {
45
52
}
46
53
47
54
$ . cwd ( frameworkPath ( 'server' ) )
48
- // TODO: need to build index.ts into index.js and then run that from within the Dockerfile
55
+
56
+ // build index.ts into index.js, to then use within the Dockerfile
49
57
await $ `bun run build` . text ( )
50
58
51
59
// this currently does not need to be enabled because our CDK deployment handles the docker build process
0 commit comments