Skip to content

Commit 9d1e1fb

Browse files
committed
Add AWS SAM template and assets
0 parents  commit 9d1e1fb

File tree

12 files changed

+654
-0
lines changed

12 files changed

+654
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Lint and upload
2+
3+
on:
4+
push:
5+
branches: ["**"]
6+
pull_request:
7+
8+
jobs:
9+
lint-templates:
10+
uses: ./.github/workflows/lint-template.yml
11+
upload-template:
12+
if: github.ref == 'refs/heads/master'
13+
permissions:
14+
contents: read
15+
id-token: write
16+
needs: [lint-templates]
17+
uses: ./.github/workflows/upload-template.yml
18+
with:
19+
tag: latest
20+
secrets: inherit
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Lint templates
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build-and-lint:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
- name: Setup Python
13+
uses: actions/setup-python@v5
14+
with:
15+
python-version: 3.9
16+
- name: Install dev dependencies
17+
run: pip install cfn-lint
18+
- name: Lint templates
19+
run: cfn-lint template.yml

.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+*'
7+
8+
jobs:
9+
lint-template:
10+
uses: ./.github/workflows/lint-template.yml
11+
upload-template:
12+
permissions:
13+
contents: read
14+
id-token: write
15+
needs: [lint-template]
16+
uses: ./.github/workflows/upload-template.yml
17+
with:
18+
tag: ${{ github.ref_name }}
19+
secrets: inherit
20+
release:
21+
needs: [lint-template, upload-template]
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: write
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
- name: Prepare notes
29+
id: prepare-notes
30+
run: |
31+
# Extract changelog entries between this and previous version headers
32+
escaped_version=$(echo ${GITHUB_REF_NAME#v} | sed -e 's/[]\/$*.^[]/\\&/g')
33+
awk "BEGIN{inrelease=0} /## \[${escaped_version}\]/{inrelease=1;next} /## \[[0-9]+\.[0-9]+\.[0-9]+.*\]/{inrelease=0;exit} {if (inrelease) print}" CHANGELOG.md \
34+
> RELEASE_NOTES.txt
35+
36+
echo "" >> RELEASE_NOTES.txt
37+
echo "[![](assets/launch-stack.svg)](https://console.aws.amazon.com/cloudformation/home#/stacks/new?stackName=imgproxy&templateURL=https://imgproxy-cf.s3.amazonaws.com/sam/${{ github.ref_name }}/template.yml)" >> RELEASE_NOTES.txt
38+
39+
# Write prerelease="true" env if tag name has any suffix after vMAJOR.MINOR.PATCH
40+
if [[ ${GITHUB_REF_NAME} =~ ^v[0-9]+\.[0-9]+\.[0-9]+.+ ]]; then
41+
echo 'prerelease="true"' >> $GITHUB_OUTPUT
42+
else
43+
echo 'prerelease="false"' >> $GITHUB_OUTPUT
44+
fi
45+
- name: Release
46+
uses: softprops/action-gh-release@v1
47+
with:
48+
body_path: RELEASE_NOTES.txt
49+
prerelease: ${{ fromJSON(steps.prepare-notes.outputs.prerelease) }}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Upload Templates to S3
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
tag:
7+
required: true
8+
type: string
9+
10+
jobs:
11+
upload:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
id-token: write
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
- name: Configure AWS Credentials
20+
uses: aws-actions/configure-aws-credentials@v4
21+
with:
22+
audience: sts.amazonaws.com
23+
aws-region: us-east-1
24+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
25+
- name: Upload template
26+
run: aws s3 cp template.yml s3://imgproxy-cf/sam/${{ inputs.tag }}/template.yml

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tmp/

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## [0.1.0] - 2024-02-07
4+
### Added
5+
- AWS SAM / CloudFormation template for deploying imgproxy to AWS Lambda

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Sergei Aleksandrovich
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<p align="center">
2+
<a href="https://imgproxy.net">
3+
<picture>
4+
<source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark.svg?sanitize=true">
5+
<source media="(prefers-color-scheme: light)" srcset="assets/logo-light.svg?sanitize=true">
6+
<img alt="imgproxy logo" src="assets/logo-light.svg?sanitize=true">
7+
</picture>
8+
</a>
9+
</p>
10+
11+
<h4 align="center">
12+
<a href="https://imgproxy.net">Website</a> |
13+
<a href="https://imgproxy.net/blog/">Blog</a> |
14+
<a href="https://docs.imgproxy.net">Documentation</a> |
15+
<a href="https://imgproxy.net/#pro">imgproxy Pro</a> |
16+
<a href="https://hub.docker.com/r/darthsim/imgproxy/">Docker</a> |
17+
<a href="https://twitter.com/imgproxy_net">Twitter</a> |
18+
<a href="https://discord.gg/5GgpXgtC9u">Discord</a>
19+
</h4>
20+
21+
<p align="center">
22+
<a href="https://github.com/imgproxy/imgproxy-aws-sam/actions"><img alt="GH Lint" src="https://img.shields.io/github/actions/workflow/status/imgproxy/imgproxy-aws-sam/lint-and-upload.yml?branch=master&label=Lint&style=for-the-badge" /></a>
23+
</p>
24+
25+
---
26+
27+
[imgproxy](https://imgproxy.net) is a fast and secure standalone server for resizing and converting remote images. The main principles of imgproxy are simplicity, speed, and security.
28+
29+
This repository contains an [AWS Serverless Application Model (SAM)](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html) template compatible with [AWS CloudFormation](https://aws.amazon.com/cloudformation/) that allows you to deploy imgproxy to AWS Lambda.
30+
31+
## Using the template
32+
33+
We uploaded the template to our S3 bucket so you can use by a click of a button. The links below will take you to the AWS CloudFormation console with the template pre-filled. You just need to provide the required parameters and click **Create stack**.
34+
35+
[![](assets/launch-stack.svg)](https://console.aws.amazon.com/cloudformation/home#/stacks/new?stackName=imgproxy&templateURL=https://imgproxy-cf.s3.amazonaws.com/sam/latest/template.yml)
36+
37+
> [!NOTE]
38+
> The link in the README points to the template from the `master` branch. If you want to use a specific version, you can find the links in the [releases](https://github.com/imgproxy/imgproxy-aws-sam/releases) section.
39+
40+
> [!WARNING]
41+
> Official Docker images of imgproxy prior to version `3.22.0` do not contain [AWS Lambda adapter](https://github.com/awslabs/aws-lambda-web-adapter).
42+
>
43+
> If you want to use the template with an older version of imgproxy, you need to build a custom Docker image with the adapter. Take note that this template assumes that the AWS Lambda adapter is configed to work in the `rsponse_stream` mode.
44+
45+
## License
46+
47+
imgproxy-aws-sam is licensed under the MIT license.
48+
49+
See [LICENSE](https://github.com/imgproxy/imgproxy-aws-sam/blob/master/LICENSE) for the full license text.
50+
51+
## Security Contact
52+
53+
To report a security vulnerability, please contact us at security@imgproxy.net. We will coordinate the fix and disclosure.

assets/launch-stack.svg

Lines changed: 19 additions & 0 deletions
Loading

assets/logo-dark.svg

Lines changed: 22 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)