From f39f4dbc3658360c6b94f5c33d1f2a21e2128ab7 Mon Sep 17 00:00:00 2001 From: kevin olson Date: Tue, 26 Mar 2024 23:18:02 -0500 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9C=A8=20properly=20deploying=20to=20the?= =?UTF-8?q?=20provided.al2023=20runtime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/deploytasks.ts | 14 +++++++++----- src/lib/types.ts | 5 +++++ 2 files changed, 14 insertions(+), 5 deletions(-) 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 { From 04e4d1024448af614e8072517e822087cb69bf2c Mon Sep 17 00:00:00 2001 From: kevin olson Date: Thu, 4 Apr 2024 22:54:23 -0500 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=9A=A7=20decide=20on=20the=20go=20bin?= =?UTF-8?q?ary=20based=20on=20if=20the=20arch=20is=20specified?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/deploytasks.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/lib/deploytasks.ts b/src/lib/deploytasks.ts index 136cf9c..6caed6e 100644 --- a/src/lib/deploytasks.ts +++ b/src/lib/deploytasks.ts @@ -57,6 +57,8 @@ export default class DeployTasks { public packager = 'yarn' + public goBinary = 'main' + async checkConfig() { try { this.fumeConfig = yml.load(fs.readFileSync('fume.yml').toString()) as YamlConfig @@ -79,8 +81,6 @@ export default class DeployTasks { fse.copySync(`${__dirname}/../../src/assets/nuxt`, './.fume') } - - async modeSelect(task: any) { const util = require('util') const format = '0.0b' @@ -315,8 +315,9 @@ exports.handler = async (event, context) => { let arch = 'amd64' if (this.deployment.entry.project.detail && this.deployment.entry.project.detail.architecture) { arch = this.deployment.entry.project.detail.architecture + this.goBinary = 'bootstrap' } - await execa('go', ['build', '-o', 'bootstrap', 'main.go'], { + await execa('go', ['build', '-o', this.goBinary, 'main.go'], { extendEnv: true, env: { GOOS: 'linux', @@ -333,10 +334,10 @@ exports.handler = async (event, context) => { pub: 0, server: 0, deps: 0, - code: fs.statSync('bootstrap').size, + code: fs.statSync(this.goBinary).size, static: 0, } - await execa('zip', [this.deployment.s3.code, 'bootstrap']) + await execa('zip', [this.deployment.s3.code, this.goBinary]) } async outputArchive(task: ListrTaskWrapper) { @@ -623,7 +624,7 @@ exports.handler = async (event, context) => { fs.unlinkSync('.env.fume') } - if (fs.existsSync('bootstrap')) fse.removeSync('bootstrap') + if (fs.existsSync(this.goBinary)) fse.removeSync(this.goBinary) 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)) From ad7c52f5779bf89e842b8c20e86ce64990122639 Mon Sep 17 00:00:00 2001 From: kevin olson Date: Tue, 16 Apr 2024 21:45:46 -0500 Subject: [PATCH 3/3] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20v2.1.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 703ccf6..aa9d4e8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "fume-cli", "description": "fume command line interface", - "version": "2.1.2", + "version": "2.1.3", "author": "acidjazz @acidjazz", "bin": { "fume": "bin/run"