Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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.html

This 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
```