-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-sam-local.ps1
More file actions
34 lines (30 loc) · 925 Bytes
/
run-sam-local.ps1
File metadata and controls
34 lines (30 loc) · 925 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<#
.SYNOPSIS
Build SAM project and start local API.
.PARAMETER Stage
배포 스테이지(dev 또는 prod). 기본값은 dev입니다.
#>
param(
[ValidateSet("dev", "prod")]
[string]$Stage = "dev"
)
# 1. 이전 빌드 아티팩트 삭제
Write-Host "`n[1/3] Removing previous build artifacts (.aws-sam)..."
if (Test-Path ".aws-sam") {
Remove-Item -Recurse -Force ".aws-sam"
Write-Host " → .aws-sam folder removed."
} else {
Write-Host " → No existing .aws-sam folder."
}
# 2. SAM 빌드
Write-Host "`n[2/3] Building SAM project (host 빌드)..."
sam build
if ($LASTEXITCODE -ne 0) {
Write-Error "SAM build failed. 스크립트를 종료합니다."
exit $LASTEXITCODE
}
# 3. SAM 로컬 API 시작
Write-Host "`n[3/3] Starting SAM local API (StageNameParam=$Stage)..."
docker pull public.ecr.aws/lambda/dotnet:8
sam local start-api --parameter-overrides "StageNameParam=$Stage"
# (끝)