Compare commits
2 commits
b9d4623d63
...
04237038fe
| Author | SHA1 | Date | |
|---|---|---|---|
| 04237038fe | |||
| 235218f11c |
2 changed files with 20 additions and 7 deletions
|
|
@ -5,8 +5,8 @@ WORKDIR /app
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
COPY . .
|
COPY . .
|
||||||
# Build with optional lambda.norpc tag
|
# Build with optional lambda.norpc tag for arm64 architecture
|
||||||
RUN go build -tags lambda.norpc -o main ./cmd/lambda
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -tags lambda.norpc -o main ./cmd/lambda
|
||||||
# Copy artifacts to a clean image
|
# Copy artifacts to a clean image
|
||||||
FROM public.ecr.aws/lambda/provided:al2023
|
FROM public.ecr.aws/lambda/provided:al2023
|
||||||
# Install git and zip using dnf (Amazon Linux 2023)
|
# Install git and zip using dnf (Amazon Linux 2023)
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,14 @@ Parameters:
|
||||||
Default: main
|
Default: main
|
||||||
Description: Git repository branch
|
Description: Git repository branch
|
||||||
|
|
||||||
|
ImageDigest:
|
||||||
|
Type: String
|
||||||
|
Default: ""
|
||||||
|
Description: "ECR image digest (e.g., sha256:abc123...). If empty, uses 'latest' tag. Use digest for deterministic deployments."
|
||||||
|
|
||||||
|
Conditions:
|
||||||
|
UseDigest: !Not [!Equals [!Ref ImageDigest, ""]]
|
||||||
|
|
||||||
Resources:
|
Resources:
|
||||||
|
|
||||||
MyLambdaRole:
|
MyLambdaRole:
|
||||||
|
|
@ -71,15 +79,20 @@ Resources:
|
||||||
Properties:
|
Properties:
|
||||||
FunctionName: blog-deployment-webhook-handler
|
FunctionName: blog-deployment-webhook-handler
|
||||||
PackageType: Image
|
PackageType: Image
|
||||||
ImageUri:
|
ImageUri: !If
|
||||||
!Join
|
- UseDigest
|
||||||
- ":"
|
- !Sub
|
||||||
- - !ImportValue BlogDeployment-RepositoryUri
|
- "${RepoUri}@${Digest}"
|
||||||
- "latest"
|
- RepoUri: !ImportValue BlogDeployment-RepositoryUri
|
||||||
|
Digest: !Ref ImageDigest
|
||||||
|
- !Sub
|
||||||
|
- "${RepoUri}:latest"
|
||||||
|
- RepoUri: !ImportValue BlogDeployment-RepositoryUri
|
||||||
Timeout: 300
|
Timeout: 300
|
||||||
MemorySize: 512
|
MemorySize: 512
|
||||||
Architectures:
|
Architectures:
|
||||||
- arm64
|
- arm64
|
||||||
|
AutoPublishAlias: live
|
||||||
Environment:
|
Environment:
|
||||||
Variables:
|
Variables:
|
||||||
REPO_URL: !Ref RepoURL
|
REPO_URL: !Ref RepoURL
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue