-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cd to aws lambda and fix docker build ci
- Loading branch information
Showing
4 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Deploy to lambda | ||
on: | ||
push: | ||
tags: ['*'] | ||
jobs: | ||
|
||
deploy_zip: | ||
name: deploy lambda function | ||
runs-on: ubuntu-latest | ||
environment: production | ||
strategy: | ||
matrix: | ||
go-version: [1.22] | ||
steps: | ||
- name: checkout source code | ||
uses: actions/checkout@v4 | ||
- name: Install Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
- name: Build binary | ||
run: | | ||
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o bootstrap -tags lambda.norpc main.go && zip linebotFunction.zip bootstrap | ||
- name: default deploy | ||
uses: appleboy/[email protected] | ||
with: | ||
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws_region: ${{ secrets.AWS_REGION }} | ||
function_name: linebotFunction | ||
zip_file: linebotFunction.zip | ||
memory_size: 256 | ||
timeout: 30 | ||
handler: bootstrap | ||
role: ${{ secrets.AWS_LAMBDA_ROLE }} | ||
runtime: provided.al2023 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"log" | ||
"net/http" | ||
|
||
"github.com/vgjm/linebot/linebot" | ||
) | ||
|
||
func main() { | ||
ctx := context.Background() | ||
|
||
lb, err := linebot.New(ctx) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
defer lb.Close() | ||
|
||
http.HandleFunc("/", lb.Callback) | ||
|
||
http.ListenAndServe(":5000", nil) | ||
|
||
} |