Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frezbo/openfaas-template-static
OpenFaaS template to serve static files
https://github.com/frezbo/openfaas-template-static
Last synced: 1 day ago
JSON representation
OpenFaaS template to serve static files
- Host: GitHub
- URL: https://github.com/frezbo/openfaas-template-static
- Owner: frezbo
- License: mit
- Created: 2020-12-20T14:48:13.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-01-25T10:02:01.000Z (almost 2 years ago)
- Last Synced: 2025-01-22T01:33:38.182Z (2 days ago)
- Language: Dockerfile
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# openfaas-template-static
An OpenFaaS template to serve static content. Inspired from [openfaas-hugo-template](https://github.com/matipan/openfaas-hugo-template)
Using the minimal `scratch` image and running as non-root
## Usage
Create a new empty repository
```bash
git init
```Pull down the `openfaas-template-static`
```bash
faas-cli template pull https://github.com/frezbo/openfaas-template-static
```Create a new FaaS project using the template
```bash
faas new --lang static-site --prefix static-site
```Now `cd` into `static-side` folder and copy over the static contents
```bash
cd static-site
cat < index.htmlThis is a static page served by OpenFaas.
EOF
```### Hardening
Since this template is based on `scratch` image `readonly_root_filesystem: true` option can be set for the OpenFaaS template.
Eg:
```yaml
version: 1.0
provider:
name: openfaas
functions:
static-site:
lang: static-site
handler: ./static-site
image: /static-site:latest
readonly_root_filesystem: true
```### Deploying
Run `faas-cli up`
```bash
faas-cli up -f static-site.yml
```