Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ properly deploying to the provided.al2023 runtime #54

Merged
merged 2 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 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 @@ -312,11 +312,16 @@ exports.handler = async (event, context) => {
async goCompile(task: ListrTaskWrapper<any, any>) {
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
this.goBinary = 'bootstrap'
}
await execa('go', ['build', '-o', this.goBinary, 'main.go'], {
extendEnv: true,
env: {
GOOS: 'linux',
GOARCH: 'amd64',
GOARCH: arch,
},
})
}
Expand All @@ -329,10 +334,10 @@ exports.handler = async (event, context) => {
pub: 0,
server: 0,
deps: 0,
code: fs.statSync('main').size,
code: fs.statSync(this.goBinary).size,
static: 0,
}
await execa('zip', [this.deployment.s3.code, 'main'])
await execa('zip', [this.deployment.s3.code, this.goBinary])
}

async outputArchive(task: ListrTaskWrapper<any, any>) {
Expand Down Expand Up @@ -619,7 +624,7 @@ exports.handler = async (event, context) => {
fs.unlinkSync('.env.fume')
}

if (fs.existsSync('main')) fse.removeSync('main')
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
5 changes: 5 additions & 0 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ export interface Project {
region: string
framework: string
structure: string
detail?: ProjectDetail
}

export interface ProjectDetail {
architecture?: string
}

export interface Env {
Expand Down
Loading