Skip to content

Commit 89bf9ee

Browse files
committed
Fixes #25 Added aws lambda layer example
1 parent 48dbc09 commit 89bf9ee

File tree

7 files changed

+11552
-2
lines changed

7 files changed

+11552
-2
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ Cargo.lock
1919
.LSOverride
2020

2121
# Icon must end with two \r
22-
Icon
22+
Icon
23+
2324

2425
# Thumbnails
2526
._*
@@ -39,3 +40,7 @@ Icon
3940
Network Trash Folder
4041
Temporary Items
4142
.apdisk
43+
44+
examples/aws/lambda/layer
45+
examples/aws/lambda/.serverless
46+
examples/aws/lambda/node_modules

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "khmercut"
3-
version = "0.1.5"
3+
version = "0.2.1"
44
edition = "2021"
55
license = "MIT"
66
description = "A blazingly fast Khmer word segmentation tool written in Rust."

examples/aws/lambda/Makefile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
ARTIFACT_URL=https://github.com/semsphy/khmercut-rs/releases/download/0.2.0/khmercut-Linux-aarch64-musl.tar.gz
3+
LAYER_DIR=layer
4+
ARTIFACT_FILE=khmercut.tar.gz
5+
6+
all: deploy
7+
8+
# Target to download the artifact
9+
download:
10+
@echo "Downloading artifact from $(ARTIFACT_URL)..."
11+
curl -L $(ARTIFACT_URL) -o $(ARTIFACT_FILE)
12+
13+
# Target to extract the artifact
14+
extract: download
15+
@echo "Extracting artifact..."
16+
mkdir -p $(LAYER_DIR)
17+
tar -xzf $(ARTIFACT_FILE) -C $(LAYER_DIR)
18+
rm $(ARTIFACT_FILE)
19+
@echo "Artifact downloaded and extracted to $(LAYER_DIR)"
20+
21+
22+
23+
deploy: extract
24+
@echo "Deploying the service..."
25+
npx serverless deploy
26+
27+
# Target to clean up
28+
clean:
29+
@echo "Cleaning up..."
30+
rm -rf $(LAYER_DIR)
31+
rm -f $(ARTIFACT_FILE)
32+
33+
.PHONY: all download extract deploy clean

examples/aws/lambda/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Build AWS Lambda layer
2+
3+
## Usage
4+
5+
Deploy a layer to aws
6+
7+
```shell
8+
make
9+
```
10+
11+
## Layers
12+
13+
| Layer | version |
14+
|------------------------------------------------------------|---------|
15+
| arn:aws:lambda:ap-southeast-1:124081850635:layer:khmercut:2| v2 |
16+
17+
18+
## References
19+
20+
- [serverless-rust](https://www.serverless.com/plugins/serverless-rust)

0 commit comments

Comments
 (0)