https://github.com/mashiike/flexentry
Flexible entry point for Amazon ECS Task and Amazon Lambda container images
https://github.com/mashiike/flexentry
Last synced: 3 months ago
JSON representation
Flexible entry point for Amazon ECS Task and Amazon Lambda container images
- Host: GitHub
- URL: https://github.com/mashiike/flexentry
- Owner: mashiike
- License: mit
- Created: 2022-01-27T00:53:40.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-05T20:57:46.000Z (almost 2 years ago)
- Last Synced: 2024-06-21T11:02:27.883Z (11 months ago)
- Language: Go
- Size: 56.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flexentry


[](https://goreportcard.com/report/mashiike/flexentry) [](https://github.com/mashiike/flexentry/blob/master/LICENSE)Flexible entry point for Amazon ECS Task and Amazon Lambda container images
## Usage
```Dockerfile
FROM golang:1.17-busterRUN apt-get update && \
apt-get install -y unzip && \
apt-get cleanRUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install && \
rm -R aws && \
rm awscliv2.zipARG FLEXENTRY_VERSION=0.2.0
RUN curl -L https://github.com/mashiike/flexentry/releases/download/v${FLEXENTRY_VERSION}/flexentry_${FLEXENTRY_VERSION}_linux_amd64.tar.gz | tar zxvf - && \
install flexentry /usr/local/bin/ENTRYPOINT ["flexentry"]
```Basically, all you have to do is specify the entry point of the container image.
### Run on ECS Task
```json
{
"containerDefinitions": [
{
"command": [
"aws --version"
],
"essential": true,
"image": "",
"name": "sample-app"
}
],
"cpu": "256",
"executionRoleArn": "arn:aws:iam::012345678910:role/ecsTaskExecutionRole",
"family": "sample-task-definition",
"memory": "512",
"networkMode": "awsvpc",
"requiresCompatibilities": [
"FARGATE"
]
}
```Decide what to execute with `command`, as in the task definition above.
### Run on Lambda with container image
If the environment variable `FLEXENTRY_COMMAND` is specified, the command will be executed.
Otherwise, the command to be executed will be determined according to the payload of the event.```json
{
"cmd": "aws --version",
"description": "this is sample"
}
```If the event payload is a string, it will be interpreted as a command.
Otherwise, by default, it looks at the `cmd` key to decide which command to execute.
To change the key, specify a jq expression for reference with `FLEXENTRY_COMMAND_JQ_EXPR`.
For example `export FLEXENTRY_COMMAND_JQ_EXPR=".command"`When executed by Amazon Lambda, the event payload is passed directly to the standard input as JSON data.
## LICENSE
MIT