Skip to content

Commit a2c39a8

Browse files
committed
SAM CLI Feature
1 parent 4fabd1b commit a2c39a8

File tree

4 files changed

+72
-2
lines changed

4 files changed

+72
-2
lines changed

src/common-amzn/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ Like [Common Debian Utilities (common-utils)](https://github.com/devcontainers/f
1212
}
1313
```
1414

15-
Add to your dev/build `Dockerfile`.
16-
1715
## Options
1816

1917
None at this time.

src/sam-cli/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
# AWS SAM CLI Utility (sam-cli)
3+
4+
Like [Common Debian Utilities (common-utils)](https://github.com/devcontainers/features/tree/main/src/common-utils) but for Amazon Linux 2.
5+
6+
## Example Usage
7+
8+
```json
9+
"features": {
10+
"ghcr.io/customink/codespaces-features/sam-cli": {}
11+
}
12+
```
13+
14+
## Options
15+
16+
| Options Id | Description | Type | Default Value |
17+
|------------|------------------------------------|--------|---------------|
18+
| version | SAM CLI version number. Ex: 1.65.0 | string | latest |

src/sam-cli/devcontainer-feature.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"id": "sam-cli",
3+
"name": "AWS SAM CLI Utility",
4+
"version": "1.0.0",
5+
"description": "The AWS Serverless Application Model (AWS SAM) is an open-source framework that you can use to build serverless applications on AWS.",
6+
"documentationURL": "https://github.com/customink/codespaces-features/tree/main/src/sam-cli",
7+
"options": {
8+
"version": {
9+
"type": "string",
10+
"proposals": ["latest", "1.65.0"],
11+
"default": "latest",
12+
"description": "Select or enter a SAM CLI version number."
13+
}
14+
}
15+
}

src/sam-cli/install.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/sh
2+
set -e
3+
4+
echo "== [Custom Ink] installing 'sam-cli' features ... =="
5+
6+
VERSION=${VERSION:-"latest"}
7+
8+
if [ "${VERSION}" = "latest" ]; then
9+
DOWNLOAD_URL="https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip"
10+
else
11+
DOWNLOAD_URL="https://github.com/aws/aws-sam-cli/releases/download/v${VERSION}/aws-sam-cli-linux-x86_64.zip"
12+
fi
13+
14+
sudoIf() {
15+
if [ "$(id -u)" != 0 ]; then
16+
sudo "\$@"
17+
else
18+
"\$@"
19+
fi
20+
}
21+
22+
cleanup() {
23+
rm -rf \
24+
install \
25+
aws-sam-cli-linux-x86_64.zip \
26+
aws-sam-cli-src \
27+
dist \
28+
THIRD-PARTY-LICENSES
29+
}
30+
31+
cd /tmp
32+
33+
cleanup
34+
35+
curl -sL "${DOWNLOAD_URL}" > "aws-sam-cli-linux-x86_64.zip"
36+
unzip -qq "aws-sam-cli-linux-x86_64.zip"
37+
sudoIf ./install --update
38+
39+
cleanup

0 commit comments

Comments
 (0)