Skip to content

Commit

Permalink
🚧 decide on the go binary based on if the arch is specified
Browse files Browse the repository at this point in the history
  • Loading branch information
acidjazz committed Apr 5, 2024
1 parent f39f4db commit 04e4d10
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/lib/deploytasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand Down Expand Up @@ -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',
Expand All @@ -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<any, any>) {
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 04e4d10

Please sign in to comment.