Skip to content

Commit 99fc414

Browse files
committed
Initial commit for deprecated templates
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
0 parents  commit 99fc414

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+929
-0
lines changed

.DEREK.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
redirect: https://raw.githubusercontent.com/openfaas/faas/master/.DEREK.yml

.github/ISSUE_TEMPLATE.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<!--- Provide a general summary of the issue in the Title above -->
2+
3+
## Expected Behaviour
4+
<!--- If you're describing a bug, tell us what should happen -->
5+
<!--- If you're suggesting a change/improvement, tell us how it should work -->
6+
7+
## Current Behaviour
8+
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
9+
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
10+
11+
## Are you a GitHub Sponsor (Yes/No?)
12+
<!--- Given this request for help, how are you supporting the project? -->
13+
14+
Check at: https://github.com/sponsors/openfaas
15+
- [ ] Yes
16+
- [ ] No
17+
18+
## List All Possible Solutions and Workarounds
19+
<!--- Suggest a fix/reason for the bug, or ideas how to implement -->
20+
<!--- the addition or change -->
21+
<!--- Is there a workaround which could avoid making changes? -->
22+
23+
## Which Solution Do You Recommend?
24+
<!--- Pick your preferred solution, if you were to implement and maintain this change -->
25+
26+
## Steps to Reproduce (for bugs)
27+
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
28+
<!--- reproduce this bug. Include code to reproduce, if relevant -->
29+
1.
30+
2.
31+
3.
32+
4.
33+
34+
## Context
35+
<!--- How has this issue affected you? What are you trying to accomplish? -->
36+
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
37+
38+
## Your Environment
39+
<!--- Include as many relevant details about the environment you experienced the bug in -->
40+
* What Docker version are you using? `docker version`
41+
42+
* What version of Kubernetes are you using? `kubectl version`
43+
44+
* Operating System and version (e.g. Linux, Windows, MacOS):
45+
46+
* Link to your project or a code example to reproduce issue:

.github/PULL_REQUEST_TEMPLATE.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!--- Provide a general summary of your changes in the Title above -->
2+
3+
## Description
4+
<!--- Describe your changes in detail -->
5+
6+
## Motivation and Context
7+
<!--- Why is this change required? What problem does it solve? -->
8+
<!--- If it fixes an open issue, please link to the issue here. -->
9+
- [ ] I have raised an issue to propose this change ([required](https://github.com/openfaas/faas/blob/master/CONTRIBUTING.md))
10+
11+
## Which issue(s) this PR fixes
12+
<!-- (optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged): -->
13+
Fixes #
14+
15+
## How Has This Been Tested?
16+
<!--- Please describe in detail how you tested your changes. -->
17+
<!--- Include details of your testing environment, and the tests you ran to -->
18+
<!--- see how your change affects other areas of the code, etc. -->
19+
20+
## Types of changes
21+
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
22+
- [ ] Bug fix (non-breaking change which fixes an issue)
23+
- [ ] New feature (non-breaking change which adds functionality)
24+
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
25+
- [ ] Version change (see: Impact to existing users)
26+
27+
## Impact to existing users
28+
29+
<!-- If none, state why and how you can be sure of that. -->
30+
31+
## Checklist:
32+
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
33+
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
34+
- [ ] My code follows the code style of this project.
35+
- [ ] My change requires a change to the documentation.
36+
- [ ] I have updated the documentation accordingly.
37+
- [ ] I've read the [CONTRIBUTION](https://github.com/openfaas/faas/blob/master/CONTRIBUTING.md) guide
38+
- [ ] I have signed-off my commits with `git commit -s`
39+
- [ ] I have added tests to cover my changes.
40+
- [ ] All new and existing tests passed.

.github/workflows/only-ci.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: ci-only
2+
3+
on:
4+
push:
5+
branches: [ "*" ]
6+
pull_request:
7+
branches: [ "*" ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@master
14+
with:
15+
fetch-depth: 1
16+
- name: Setup faas-cli
17+
run: curl -sSL https://cli.openfaas.com | sh
18+
- name: Make all
19+
run: make all

LICENSE

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

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
all:
3+
bash verify.sh

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# OpenFaaS Classic templates
2+
3+
These templates should be considered deprecated, and recommended templates from the documentation or Function Store should be used instead.
4+
5+
They are retained in this repository for backwards compatibility purposes.
6+
7+
See also: [Language support](https://docs.openfaas.com/languages/overview/).
8+
9+
### License
10+
11+
This project is part of the OpenFaaS project licensed under the MIT License.

template/bun/Dockerfile

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/of-watchdog:0.10.6 AS watchdog
2+
FROM --platform=${TARGETPLATFORM:-linux/amd64} oven/bun:1.0-alpine AS ship
3+
4+
ARG TARGETPLATFORM
5+
ARG BUILDPLATFORM
6+
7+
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
8+
RUN chmod +x /usr/bin/fwatchdog
9+
10+
RUN addgroup -S app && adduser app -S -G app
11+
12+
WORKDIR /root/
13+
14+
RUN mkdir -p /home/app
15+
16+
# Wrapper/boot-strapper
17+
WORKDIR /home/app
18+
COPY package.json ./
19+
COPY jsconfig.json ./
20+
COPY bun.lockb ./
21+
22+
# This ordering means the npm installation is cached for the outer function handler.
23+
RUN bun install --production
24+
25+
# Copy outer function handler
26+
COPY index.js ./
27+
28+
# COPY function node packages and install, adding this as a separate
29+
# entry allows caching of npm install runtime dependencies
30+
WORKDIR /home/app/function
31+
COPY function/*.json ./
32+
RUN bun install --production || :
33+
34+
# Copy in additional function files and folders
35+
COPY --chown=app:app function/ .
36+
37+
WORKDIR /home/app/
38+
39+
# chmod for tmp is for a buildkit issue (@alexellis)
40+
RUN chmod +rx -R ./function \
41+
&& chown app:app -R /home/app \
42+
&& chmod 777 /tmp
43+
44+
USER app
45+
46+
ENV cgi_headers="true"
47+
ENV fprocess="bun run index.js"
48+
ENV mode="http"
49+
ENV upstream_url="http://127.0.0.1:3000"
50+
51+
ENV exec_timeout="10s"
52+
ENV write_timeout="15s"
53+
ENV read_timeout="15s"
54+
55+
ENV prefix_logs="false"
56+
57+
HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1
58+
59+
CMD ["fwatchdog"]

template/bun/README.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# bun
2+
3+
To install dependencies:
4+
5+
```bash
6+
bun install
7+
```
8+
9+
To run:
10+
11+
```bash
12+
bun run index.js
13+
```
14+
15+
This project was created using `bun init` in bun v1.0.3. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.

template/bun/bun.lockb

22.4 KB
Binary file not shown.

template/bun/function/README.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# openfaas-function
2+
3+
To install dependencies:
4+
5+
```bash
6+
bun install
7+
```
8+
9+
To run:
10+
11+
```bash
12+
bun run handler.js
13+
```
14+
15+
This project was created using `bun init` in bun v1.0.3. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.

template/bun/function/bun.lockb

1.26 KB
Binary file not shown.

template/bun/function/handler.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict'
2+
3+
module.exports = async (event, context) => {
4+
const result = {
5+
'body': JSON.stringify(event.body),
6+
'content-type': event.headers["content-type"]
7+
}
8+
9+
return context
10+
.status(200)
11+
.succeed(result)
12+
}

template/bun/function/jsconfig.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"compilerOptions": {
3+
"lib": ["ESNext"],
4+
"module": "esnext",
5+
"target": "esnext",
6+
"moduleResolution": "bundler",
7+
"moduleDetection": "force",
8+
"allowImportingTsExtensions": true,
9+
"noEmit": true,
10+
"composite": true,
11+
"strict": true,
12+
"downlevelIteration": true,
13+
"skipLibCheck": true,
14+
"jsx": "react-jsx",
15+
"allowSyntheticDefaultImports": true,
16+
"forceConsistentCasingInFileNames": true,
17+
"allowJs": true,
18+
"types": [
19+
"bun-types" // add Bun global
20+
]
21+
}
22+
}

template/bun/function/package.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "openfaas-function",
3+
"version": "1.0.0",
4+
"description": "OpenFaaS Function",
5+
"main": "handler.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 0"
8+
},
9+
"keywords": [],
10+
"author": "OpenFaaS Ltd",
11+
"license": "MIT",
12+
"devDependencies": {
13+
"bun-types": "latest"
14+
},
15+
"peerDependencies": {
16+
"typescript": "^5.0.0"
17+
}
18+
}

0 commit comments

Comments
 (0)