diff --git a/src/lib/deploytasks.ts b/src/lib/deploytasks.ts index 26f90ff..136cf9c 100644 --- a/src/lib/deploytasks.ts +++ b/src/lib/deploytasks.ts @@ -312,11 +312,15 @@ exports.handler = async (event, context) => { async goCompile(task: ListrTaskWrapper) { task.title = 'Compiling go binary' await this.deployment.update('GO_COMPILE') - await execa('go', ['build', '-o', 'main', 'main.go'], { + let arch = 'amd64' + if (this.deployment.entry.project.detail && this.deployment.entry.project.detail.architecture) { + arch = this.deployment.entry.project.detail.architecture + } + await execa('go', ['build', '-o', 'bootstrap', 'main.go'], { extendEnv: true, env: { GOOS: 'linux', - GOARCH: 'amd64', + GOARCH: arch, }, }) } @@ -329,10 +333,10 @@ exports.handler = async (event, context) => { pub: 0, server: 0, deps: 0, - code: fs.statSync('main').size, + code: fs.statSync('bootstrap').size, static: 0, } - await execa('zip', [this.deployment.s3.code, 'main']) + await execa('zip', [this.deployment.s3.code, 'bootstrap']) } async outputArchive(task: ListrTaskWrapper) { @@ -619,7 +623,7 @@ exports.handler = async (event, context) => { fs.unlinkSync('.env.fume') } - if (fs.existsSync('main')) fse.removeSync('main') + if (fs.existsSync('bootstrap')) fse.removeSync('bootstrap') if (fs.existsSync(this.deployment.s3.paths.code)) fse.removeSync(this.deployment.s3.paths.code) if (this && this.deployment.s3.code && fs.existsSync(this.deployment.s3.code)) diff --git a/src/lib/types.ts b/src/lib/types.ts index 6210d7c..4da2515 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -73,6 +73,11 @@ export interface Project { region: string framework: string structure: string + detail?: ProjectDetail +} + +export interface ProjectDetail { + architecture?: string } export interface Env {