add deploy script
This commit is contained in:
parent
82b6a7a718
commit
89edcce799
18
backend/deploy.sh
Executable file
18
backend/deploy.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
tmpdir=$(mktemp -d)
|
||||
trap 'rm -rf "$tmpdir"' EXIT
|
||||
|
||||
cd $(dirname $0)/dist
|
||||
zip -r "$tmpdir/lambda.zip" .
|
||||
|
||||
cd $tmpdir
|
||||
aws s3 cp lambda.zip "s3://$IMBUSY_BE_BUCKET"
|
||||
cd $(dirname $0)
|
||||
|
||||
aws lambda update-function-code \
|
||||
--function-name $IMBUSY_BE_LAMBDA \
|
||||
--s3-bucket $IMBUSY_BE_BUCKET \
|
||||
--s3-key lambda.zip
|
@ -6,7 +6,8 @@
|
||||
"scripts": {
|
||||
"build": "esbuild src/index.ts --bundle --platform=node --target=node18 --outfile=dist/index.js",
|
||||
"clean": "rm -rf dist",
|
||||
"watch": "npm run build -- --watch"
|
||||
"watch": "npm run build -- --watch",
|
||||
"deploy": "./deploy.sh"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
@ -22,8 +22,7 @@ phases:
|
||||
post_build:
|
||||
commands:
|
||||
- echo deploying frontend...
|
||||
- aws s3 sync frontend/dist/ s3://$IMBUSY_FE_BUCKET --delete
|
||||
- cd frontend && npm run deploy && cd ..
|
||||
|
||||
- echo deploying backend...
|
||||
- cd backend/dist && zip -r ../../backend.zip . && cd ../..
|
||||
- aws s3 cp backend.zip s3://$IMBUSY_BE_BUCKET
|
||||
- cd backend && npm run deploy && cd ..
|
||||
|
6
frontend/deploy.sh
Executable file
6
frontend/deploy.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
cd $(dirname $0)/dist
|
||||
aws s3 sync . "s3://$IMBUSY_FE_BUCKET" --delete
|
@ -7,7 +7,8 @@
|
||||
"dev": "vite",
|
||||
"build": "tsc -b && vite build",
|
||||
"lint": "eslint .",
|
||||
"preview": "vite preview"
|
||||
"preview": "vite preview",
|
||||
"deploy": "./deploy.sh"
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^19.1.0",
|
||||
|
@ -23,7 +23,7 @@ new aws.iam.RolePolicyAttachment(`${prefix}-lambda-role-exec`, {
|
||||
policyArn: aws.iam.ManagedPolicies.AWSLambdaBasicExecutionRole,
|
||||
});
|
||||
|
||||
const lambda = new aws.lambda.Function(`${prefix}-lambda`, {
|
||||
export const lambda = new aws.lambda.Function(`${prefix}-lambda`, {
|
||||
tags,
|
||||
runtime: "nodejs18.x",
|
||||
handler: "index.main",
|
||||
|
@ -6,5 +6,8 @@ import * as frontend from "./frontend";
|
||||
|
||||
import "./deployment";
|
||||
|
||||
export const frontendDomain = frontend.cloudfront.domainName;
|
||||
export const backendEndpoint = backend.api.apiEndpoint;
|
||||
export const feBucket = frontend.bucket.bucket;
|
||||
export const feDomain = frontend.cloudfront.domainName;
|
||||
export const beBucket = backend.bucket.bucket;
|
||||
export const beLambda = backend.lambda.name;
|
||||
export const beEndpoint = backend.api.apiEndpoint;
|
||||
|
Loading…
x
Reference in New Issue
Block a user