From c5224a64eda354044296fd35b5c5a547b1c1182a Mon Sep 17 00:00:00 2001 From: "Alex Ellis (OpenFaaS Ltd)" Date: Thu, 23 Jan 2025 10:46:35 +0000 Subject: [PATCH] Remove EOL templates EOL templates are now available in a separate repository https://github.com/openfaas/templates-classic Signed-off-by: Alex Ellis (OpenFaaS Ltd) --- README.md | 25 ++- template/bun/Dockerfile | 59 ------- template/bun/README.md | 15 -- template/bun/bun.lockb | Bin 22961 -> 0 bytes template/bun/function/README.md | 15 -- template/bun/function/bun.lockb | Bin 1286 -> 0 bytes template/bun/function/handler.js | 12 -- template/bun/function/jsconfig.json | 22 --- template/bun/function/package.json | 18 --- template/bun/index.js | 144 ------------------ template/bun/jsconfig.json | 22 --- template/bun/package.json | 17 --- template/bun/template.yml | 4 - template/csharp/.dockerignore | 2 - template/csharp/.gitignore | 2 - template/csharp/Dockerfile | 42 ----- template/csharp/Program.cs | 24 --- template/csharp/function/.gitignore | 5 - template/csharp/function/Function.csproj | 9 -- template/csharp/function/FunctionHandler.cs | 12 -- template/csharp/root.csproj | 20 --- template/csharp/template.yml | 7 - template/go/Dockerfile | 58 ------- template/go/function/go.mod | 3 - template/go/function/handler.go | 10 -- template/go/go.mod | 3 - template/go/go.work | 6 - template/go/main.go | 23 --- template/go/template.yml | 25 --- template/node/.dockerignore | 1 - template/node/Dockerfile | 53 ------- template/node/function/handler.js | 5 - template/node/function/package.json | 12 -- template/node/index.js | 38 ----- template/node/package.json | 15 -- template/node/template.yml | 9 -- template/python27/Dockerfile | 55 ------- template/python27/function/handler.py | 7 - template/python27/function/requirements.txt | 0 template/python27/index.py | 18 --- template/python27/requirements.txt | 0 template/python27/template.yml | 30 ---- template/python3-debian/Dockerfile | 58 ------- template/python3-debian/function/__init__.py | 0 template/python3-debian/function/handler.py | 7 - .../python3-debian/function/requirements.txt | 0 template/python3-debian/index.py | 20 --- template/python3-debian/requirements.txt | 0 template/python3-debian/template.yml | 2 - template/python3/Dockerfile | 57 ------- template/python3/function/__init__.py | 0 template/python3/function/handler.py | 7 - template/python3/function/requirements.txt | 0 template/python3/index.py | 21 --- template/python3/requirements.txt | 0 template/python3/template.yml | 37 ----- template/ruby/Dockerfile | 42 ----- template/ruby/Gemfile | 1 - template/ruby/function/Gemfile | 2 - template/ruby/function/handler.rb | 5 - template/ruby/index.rb | 12 -- template/ruby/template.yml | 24 --- 62 files changed, 17 insertions(+), 1125 deletions(-) delete mode 100644 template/bun/Dockerfile delete mode 100644 template/bun/README.md delete mode 100755 template/bun/bun.lockb delete mode 100644 template/bun/function/README.md delete mode 100755 template/bun/function/bun.lockb delete mode 100644 template/bun/function/handler.js delete mode 100644 template/bun/function/jsconfig.json delete mode 100644 template/bun/function/package.json delete mode 100644 template/bun/index.js delete mode 100644 template/bun/jsconfig.json delete mode 100644 template/bun/package.json delete mode 100644 template/bun/template.yml delete mode 100644 template/csharp/.dockerignore delete mode 100644 template/csharp/.gitignore delete mode 100644 template/csharp/Dockerfile delete mode 100644 template/csharp/Program.cs delete mode 100644 template/csharp/function/.gitignore delete mode 100644 template/csharp/function/Function.csproj delete mode 100644 template/csharp/function/FunctionHandler.cs delete mode 100644 template/csharp/root.csproj delete mode 100644 template/csharp/template.yml delete mode 100644 template/go/Dockerfile delete mode 100644 template/go/function/go.mod delete mode 100644 template/go/function/handler.go delete mode 100644 template/go/go.mod delete mode 100644 template/go/go.work delete mode 100644 template/go/main.go delete mode 100644 template/go/template.yml delete mode 100644 template/node/.dockerignore delete mode 100644 template/node/Dockerfile delete mode 100644 template/node/function/handler.js delete mode 100644 template/node/function/package.json delete mode 100644 template/node/index.js delete mode 100644 template/node/package.json delete mode 100644 template/node/template.yml delete mode 100644 template/python27/Dockerfile delete mode 100644 template/python27/function/handler.py delete mode 100644 template/python27/function/requirements.txt delete mode 100644 template/python27/index.py delete mode 100644 template/python27/requirements.txt delete mode 100644 template/python27/template.yml delete mode 100644 template/python3-debian/Dockerfile delete mode 100644 template/python3-debian/function/__init__.py delete mode 100644 template/python3-debian/function/handler.py delete mode 100644 template/python3-debian/function/requirements.txt delete mode 100644 template/python3-debian/index.py delete mode 100644 template/python3-debian/requirements.txt delete mode 100644 template/python3-debian/template.yml delete mode 100644 template/python3/Dockerfile delete mode 100644 template/python3/function/__init__.py delete mode 100644 template/python3/function/handler.py delete mode 100644 template/python3/function/requirements.txt delete mode 100644 template/python3/index.py delete mode 100644 template/python3/requirements.txt delete mode 100644 template/python3/template.yml delete mode 100644 template/ruby/Dockerfile delete mode 100644 template/ruby/Gemfile delete mode 100644 template/ruby/function/Gemfile delete mode 100644 template/ruby/function/handler.rb delete mode 100644 template/ruby/index.rb delete mode 100644 template/ruby/template.yml diff --git a/README.md b/README.md index b757c77a..25fc1436 100644 --- a/README.md +++ b/README.md @@ -17,24 +17,33 @@ See: `faas-cli template store list` to see which templates are both: recommended | Name | Language | Version | Linux base | Watchdog | Link |:-----|:---------|:--------|:-----------|:---------|:---- | dockerfile | Dockerfile | N/A | Alpine Linux | classic | [Dockerfile template](https://github.com/openfaas/templates/tree/master/template/dockerfile) -| go | Go | 1.23 | Alpine Linux | classic | [Legacy Go template (deprecated)](https://github.com/openfaas/templates/tree/master/template/go) | node18 | NodeJS | 18 | Alpine Linux | of-watchdog | [NodeJS template (deprecated)](https://github.com/openfaas/templates/tree/master/template/node18) | node20 | NodeJS | 20 | Alpine Linux | of-watchdog | [NodeJS template](https://github.com/openfaas/templates/tree/master/template/node20) -| bun-express | Bun | 1.0 | Alpine Linux | of-watchdog | [NodeJS template](https://github.com/openfaas/templates/tree/master/template/bun-express) -| node | NodeJS | 20 | Alpine Linux | classic | [Legacy NodeJS template (deprecated)](https://github.com/openfaas/templates/tree/master/template/node) -| python3 | Python | 3 | Alpine Linux | classic | [Legacy Python 3 template](https://github.com/openfaas/templates/tree/master/template/python3) -| python3-debian | Python | 3 | Debian Linux | classic | [Legacy Python 3 Debian template](https://github.com/openfaas/templates/tree/master/template/python3-debian) -| python27 | Python | 2.7.18 | Alpine Linux | classic | [Python 2.7 template (deprecated)](https://github.com/openfaas/templates/tree/master/template/python27) | java11-vert-x | Java and [Vert.x](https://vertx.io/) | 11 | Debian GNU/Linux | of-watchdog | [Java LTS template](https://github.com/openfaas/templates/tree/master/template/java11-vert-x) | java11 | Java | 11 | Debian GNU/Linux | of-watchdog | [Deprecated Java template](https://github.com/openfaas/templates/tree/master/template/java11) | java17 | Java | 11 | Debian GNU/Linux | of-watchdog | [Java LTS template](https://github.com/openfaas/templates/tree/master/template/java17) -| ruby | Ruby | 3.3 | Alpine Linux | classic| [Ruby template](https://github.com/openfaas/templates/tree/master/template/ruby) | php7 | PHP | 7.4 | Alpine Linux | classic | [PHP 7 template](https://github.com/openfaas/templates/tree/master/template/php7) | php8 | PHP | 8.2 | Alpine Linux | classic | [PHP 8 template](https://github.com/openfaas/templates/tree/master/template/php8) -| csharp | C# | N/A | Debian GNU/Linux 9 | classic | [Legacy C# template (deprecated)](https://github.com/openfaas/templates/tree/master/template/csharp) For more information on the templates check out the [docs](https://docs.openfaas.com/cli/templates/). +### Moved Classic Templates + +A number of long deprecated templates have been moved out of this repository into a new repository to indicate their End Of Life (EOL) status. + +In most cases, alternatives have already been provided and are listed int the Function Store, or the [Languages section of the OpenFaaS documentation](https://docs.openfaas.com/languages/overview/). + +Moved templates: + +* go +* python3 +* python3-debian +* python27 +* ruby +* csharp +* bun-express +* node + ### Classic vs of-watchdog templates The current version of OpenFaaS templates use the original `watchdog` which `forks` processes - a bit like CGI. The newer watchdog [of-watchdog](https://github.com/openfaas/of-watchdog) is more similar to fastCGI/HTTP and should be used for any benchmarking or performance testing along with one of the newer templates. Contact the project for more information. diff --git a/template/bun/Dockerfile b/template/bun/Dockerfile deleted file mode 100644 index 4d7ea117..00000000 --- a/template/bun/Dockerfile +++ /dev/null @@ -1,59 +0,0 @@ -FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/of-watchdog:0.10.7 AS watchdog -FROM --platform=${TARGETPLATFORM:-linux/amd64} oven/bun:1.0-alpine AS ship - -ARG TARGETPLATFORM -ARG BUILDPLATFORM - -COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog -RUN chmod +x /usr/bin/fwatchdog - -RUN addgroup -S app && adduser app -S -G app - -WORKDIR /root/ - -RUN mkdir -p /home/app - -# Wrapper/boot-strapper -WORKDIR /home/app -COPY package.json ./ -COPY jsconfig.json ./ -COPY bun.lockb ./ - -# This ordering means the npm installation is cached for the outer function handler. -RUN bun install --production - -# Copy outer function handler -COPY index.js ./ - -# COPY function node packages and install, adding this as a separate -# entry allows caching of npm install runtime dependencies -WORKDIR /home/app/function -COPY function/*.json ./ -RUN bun install --production || : - -# Copy in additional function files and folders -COPY --chown=app:app function/ . - -WORKDIR /home/app/ - -# chmod for tmp is for a buildkit issue (@alexellis) -RUN chmod +rx -R ./function \ - && chown app:app -R /home/app \ - && chmod 777 /tmp - -USER app - -ENV cgi_headers="true" -ENV fprocess="bun run index.js" -ENV mode="http" -ENV upstream_url="http://127.0.0.1:3000" - -ENV exec_timeout="10s" -ENV write_timeout="15s" -ENV read_timeout="15s" - -ENV prefix_logs="false" - -HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1 - -CMD ["fwatchdog"] diff --git a/template/bun/README.md b/template/bun/README.md deleted file mode 100644 index ac8afed6..00000000 --- a/template/bun/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# bun - -To install dependencies: - -```bash -bun install -``` - -To run: - -```bash -bun run index.js -``` - -This project was created using `bun init` in bun v1.0.3. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime. diff --git a/template/bun/bun.lockb b/template/bun/bun.lockb deleted file mode 100755 index 84e85afc23c3a659de885b6f90814011780686ba..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 22961 zcmeHPc|4Wd*FQK44J6VWNh!`TCX}H;gF=QhE5pIzI8Nsr6%9yAu3KrAG)YQDN+r#4 zMbV%^h30UhqTx2zyVm1up6>l|xbN?e_w#<*KHGlwv-fwcwbx#IKYKs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Q_`j_|sa}xUdfI{(6+p`ZUb+q%_9TF8xS)7So7Vom&<6D1Z&7s2 zr1V?^s0odaBk8;w_5iqCrI1Zoil?-7CfP91_7F5Ow7b;9QQG5|wmAVRv>fVQ^3;dP zkw2fs+QdHPP9FR>J5FWSC2)4G;#09vq<_Jv_e3A$y`;-=h zp;rU4^ehO4R@L&7f!Z~rKG3r(i+a-_1@Y6450F3QL6_3!G0Arh#ClWyV*v%9Igl@( v;}2zW4X^^54>OOM1Oq{4z{~+@L*@VD z{|7Ua1TzUKWn_Sui)=JYTufK!H7410r=EPgA$f)`>vk31^2G&oV zd~7cy2QI_10%{`IXE$2BP%7WD5UAS=4F(W6ck(O>ldY_XBL+fRqEvxz>% diff --git a/template/bun/function/handler.js b/template/bun/function/handler.js deleted file mode 100644 index 18f543d4..00000000 --- a/template/bun/function/handler.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict' - -module.exports = async (event, context) => { - const result = { - 'body': JSON.stringify(event.body), - 'content-type': event.headers["content-type"] - } - - return context - .status(200) - .succeed(result) -} diff --git a/template/bun/function/jsconfig.json b/template/bun/function/jsconfig.json deleted file mode 100644 index 7556e1d4..00000000 --- a/template/bun/function/jsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "lib": ["ESNext"], - "module": "esnext", - "target": "esnext", - "moduleResolution": "bundler", - "moduleDetection": "force", - "allowImportingTsExtensions": true, - "noEmit": true, - "composite": true, - "strict": true, - "downlevelIteration": true, - "skipLibCheck": true, - "jsx": "react-jsx", - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "allowJs": true, - "types": [ - "bun-types" // add Bun global - ] - } -} diff --git a/template/bun/function/package.json b/template/bun/function/package.json deleted file mode 100644 index 8fa34153..00000000 --- a/template/bun/function/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "openfaas-function", - "version": "1.0.0", - "description": "OpenFaaS Function", - "main": "handler.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 0" - }, - "keywords": [], - "author": "OpenFaaS Ltd", - "license": "MIT", - "devDependencies": { - "bun-types": "latest" - }, - "peerDependencies": { - "typescript": "^5.0.0" - } -} \ No newline at end of file diff --git a/template/bun/index.js b/template/bun/index.js deleted file mode 100644 index 8c47b59b..00000000 --- a/template/bun/index.js +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) Alex Ellis 2021. All rights reserved. -// Copyright (c) OpenFaaS Author(s) 2021. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -"use strict" - -import express from "express"; -const app = express() -const handler = require('./function/handler'); -const bodyParser = require('body-parser') - -const defaultMaxSize = '100kb' // body-parser default - -app.disable('x-powered-by'); - -const rawLimit = process.env.MAX_RAW_SIZE || defaultMaxSize -const jsonLimit = process.env.MAX_JSON_SIZE || defaultMaxSize - -app.use(function addDefaultContentType(req, res, next) { - // When no content-type is given, the body element is set to - // nil, and has been a source of contention for new users. - - if(!req.headers['content-type']) { - req.headers['content-type'] = "text/plain" - } - next() -}) - -if (process.env.RAW_BODY === 'true') { - app.use(bodyParser.raw({ type: '*/*' , limit: rawLimit })) -} else { - app.use(bodyParser.text({ type : "text/*" })); - app.use(bodyParser.json({ limit: jsonLimit})); - app.use(bodyParser.urlencoded({ extended: true })); -} - -const isArray = (a) => { - return (!!a) && (a.constructor === Array); -}; - -const isObject = (a) => { - return (!!a) && (a.constructor === Object); -}; - -class FunctionEvent { - constructor(req) { - this.body = req.body; - this.headers = req.headers; - this.method = req.method; - this.query = req.query; - this.path = req.path; - } -} - -class FunctionContext { - constructor(cb) { - this.statusCode = 200; - this.cb = cb; - this.headerValues = {}; - this.cbCalled = 0; - } - - status(statusCode) { - if(!statusCode) { - return this.statusCode; - } - - this.statusCode = statusCode; - return this; - } - - headers(value) { - if(!value) { - return this.headerValues; - } - - this.headerValues = value; - return this; - } - - succeed(value) { - let err; - this.cbCalled++; - this.cb(err, value); - } - - fail(value) { - let message; - if(this.status() == "200") { - this.status(500) - } - - this.cbCalled++; - this.cb(value, message); - } -} - -const middleware = async (req, res) => { - const cb = (err, functionResult) => { - if (err) { - console.error(err); - - return res.status(fnContext.status()) - .send(err.toString ? err.toString() : err); - } - - if(isArray(functionResult) || isObject(functionResult)) { - res.set(fnContext.headers()) - .status(fnContext.status()).send(JSON.stringify(functionResult)); - } else { - res.set(fnContext.headers()) - .status(fnContext.status()) - .send(functionResult); - } - }; - - const fnEvent = new FunctionEvent(req); - const fnContext = new FunctionContext(cb); - - Promise.resolve(handler(fnEvent, fnContext, cb)) - .then(res => { - if(!fnContext.cbCalled) { - fnContext.succeed(res); - } - }) - .catch(e => { - cb(e); - }); -}; - -app.post('/*', middleware); -app.get('/*', middleware); -app.patch('/*', middleware); -app.put('/*', middleware); -app.delete('/*', middleware); -app.options('/*', middleware); - -const port = process.env.http_port || 3000; - -app.listen(port, () => { - console.log(`bun-express listening on port: ${port}`) -}); - - diff --git a/template/bun/jsconfig.json b/template/bun/jsconfig.json deleted file mode 100644 index 7556e1d4..00000000 --- a/template/bun/jsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "lib": ["ESNext"], - "module": "esnext", - "target": "esnext", - "moduleResolution": "bundler", - "moduleDetection": "force", - "allowImportingTsExtensions": true, - "noEmit": true, - "composite": true, - "strict": true, - "downlevelIteration": true, - "skipLibCheck": true, - "jsx": "react-jsx", - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "allowJs": true, - "types": [ - "bun-types" // add Bun global - ] - } -} diff --git a/template/bun/package.json b/template/bun/package.json deleted file mode 100644 index 1a1117c5..00000000 --- a/template/bun/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "bun", - "module": "index.js", - "type": "module", - "devDependencies": { - "bun-types": "latest" - }, - "peerDependencies": { - "typescript": "^5.0.0" - }, - "scripts": { - "run": "bun run index.js" - }, - "dependencies": { - "express": "^4.18.2" - } -} \ No newline at end of file diff --git a/template/bun/template.yml b/template/bun/template.yml deleted file mode 100644 index 7b9374be..00000000 --- a/template/bun/template.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: bun-express -welcome_message: | - This template uses the Bun framework and Express.js to - build functions. To install packages run: bun install. diff --git a/template/csharp/.dockerignore b/template/csharp/.dockerignore deleted file mode 100644 index 1746e326..00000000 --- a/template/csharp/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -bin -obj diff --git a/template/csharp/.gitignore b/template/csharp/.gitignore deleted file mode 100644 index c6e49efc..00000000 --- a/template/csharp/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -obj/ -bin/ diff --git a/template/csharp/Dockerfile b/template/csharp/Dockerfile deleted file mode 100644 index efbd46b9..00000000 --- a/template/csharp/Dockerfile +++ /dev/null @@ -1,42 +0,0 @@ -FROM ghcr.io/openfaas/classic-watchdog:0.3.1 AS watchdog - -FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS builder - -# Supress collection of data. -ENV DOTNET_CLI_TELEMETRY_OPTOUT 1 - -# Optimize for Docker builder caching by adding projects first. - -RUN mkdir -p /home/app/src/function -WORKDIR /home/app/src/function -COPY ./function/Function.csproj . - -WORKDIR /home/app/src/ -COPY ./root.csproj . -RUN dotnet restore ./root.csproj - -COPY . . - -RUN dotnet publish -c release -o published - -FROM mcr.microsoft.com/dotnet/core/runtime:3.1 - -COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog -RUN chmod +x /usr/bin/fwatchdog - -# Create a non-root user -RUN addgroup --system app \ - && adduser --system --ingroup app app - -WORKDIR /home/app/ -COPY --from=builder /home/app/src/published . -RUN chown app:app -R /home/app - -USER app - -ENV fprocess="dotnet ./root.dll" -EXPOSE 8080 - -HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1 - -CMD ["fwatchdog"] diff --git a/template/csharp/Program.cs b/template/csharp/Program.cs deleted file mode 100644 index a3e35491..00000000 --- a/template/csharp/Program.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Alex Ellis 2017. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System; -using System.Text; -using Function; - -namespace root -{ - class Program - { - static void Main(string[] args) - { - string buffer = Console.In.ReadToEnd(); - FunctionHandler f = new FunctionHandler(); - - string responseValue = f.Handle(buffer); - - if(responseValue != null) { - Console.Write(responseValue); - } - } - } -} diff --git a/template/csharp/function/.gitignore b/template/csharp/function/.gitignore deleted file mode 100644 index c74559e2..00000000 --- a/template/csharp/function/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -bin/ -obj/ -.nuget/ -.dotnet/ -.templateengine/ diff --git a/template/csharp/function/Function.csproj b/template/csharp/function/Function.csproj deleted file mode 100644 index 726d10a3..00000000 --- a/template/csharp/function/Function.csproj +++ /dev/null @@ -1,9 +0,0 @@ - - - - netstandard2.0 - - - false - - diff --git a/template/csharp/function/FunctionHandler.cs b/template/csharp/function/FunctionHandler.cs deleted file mode 100644 index 52b47f03..00000000 --- a/template/csharp/function/FunctionHandler.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Text; - -namespace Function -{ - public class FunctionHandler - { - public string Handle(string input) { - return $"Hi there - your input was: {input}\n"; - } - } -} diff --git a/template/csharp/root.csproj b/template/csharp/root.csproj deleted file mode 100644 index 90994556..00000000 --- a/template/csharp/root.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - false - - - - - - - Exe - netcoreapp3.1 - - - false - - diff --git a/template/csharp/template.yml b/template/csharp/template.yml deleted file mode 100644 index 8d64b2ce..00000000 --- a/template/csharp/template.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: csharp -fprocess: dotnet ./root.dll -welcome_message: | - This template is deprecated and will be removed in a future - release. - - Use dotnet8-csharp instead. diff --git a/template/go/Dockerfile b/template/go/Dockerfile deleted file mode 100644 index fad7c13b..00000000 --- a/template/go/Dockerfile +++ /dev/null @@ -1,58 +0,0 @@ -FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/classic-watchdog:0.3.1 AS watchdog -FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.23-alpine3.20 AS build - -ARG TARGETPLATFORM -ARG BUILDPLATFORM -ARG TARGETOS -ARG TARGETARCH - -# Required to enable Go modules -RUN apk add --no-cache git - -# Allows you to add additional packages via build-arg -ARG ADDITIONAL_PACKAGE -ARG CGO_ENABLED=0 -ARG GO111MODULE="off" -ARG GOPROXY="" -ARG GOFLAGS="" - -COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog -RUN chmod +x /usr/bin/fwatchdog - -ENV CGO_ENABLED=0 - -WORKDIR /go/src/handler -COPY . . - -# Run a gofmt and exclude all vendored code. -RUN test -z "$(gofmt -l $(find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./function/vendor/*"))" || { echo "Run \"gofmt -s -w\" on your Golang code"; exit 1; } - -WORKDIR /go/src/handler/function -RUN mkdir -p /go/src/handler/function/static - -RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=${CGO_ENABLED} go test ./... -cover - -WORKDIR /go/src/handler - -RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=${CGO_ENABLED} \ - go build --ldflags "-s -w" -o handler . - -FROM --platform=${TARGETPLATFORM:-linux/amd64} alpine:3.21.2 AS ship - -RUN apk --no-cache add ca-certificates \ - && addgroup -S app && adduser -S -g app app - -WORKDIR /home/app - -COPY --from=build --chown=app /usr/bin/fwatchdog . -COPY --from=build --chown=app /go/src/handler/handler . -COPY --from=build --chown=app /go/src/handler/function/static static - -USER app - -ENV fprocess="./handler" -EXPOSE 8080 - -HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1 - -CMD ["./fwatchdog"] diff --git a/template/go/function/go.mod b/template/go/function/go.mod deleted file mode 100644 index 3e759ef8..00000000 --- a/template/go/function/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module handler/function - -go 1.23 diff --git a/template/go/function/handler.go b/template/go/function/handler.go deleted file mode 100644 index 0c3f15fb..00000000 --- a/template/go/function/handler.go +++ /dev/null @@ -1,10 +0,0 @@ -package function - -import ( - "fmt" -) - -// Handle a serverless request -func Handle(req []byte) string { - return fmt.Sprintf("Hello, Go. You said: %s", string(req)) -} diff --git a/template/go/go.mod b/template/go/go.mod deleted file mode 100644 index 5076a434..00000000 --- a/template/go/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module handler - -go 1.23 diff --git a/template/go/go.work b/template/go/go.work deleted file mode 100644 index e609a15b..00000000 --- a/template/go/go.work +++ /dev/null @@ -1,6 +0,0 @@ -go 1.23 - -use ( - . - ./function -) diff --git a/template/go/main.go b/template/go/main.go deleted file mode 100644 index 7c376214..00000000 --- a/template/go/main.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Alex Ellis 2017. All rights reserved. -// Copyright (c) OpenFaaS Author(s) 2018. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -package main - -import ( - "fmt" - "io/ioutil" - "log" - "os" - - "handler/function" -) - -func main() { - input, err := ioutil.ReadAll(os.Stdin) - if err != nil { - log.Fatalf("Unable to read standard input: %s", err.Error()) - } - - fmt.Println(function.Handle(input)) -} diff --git a/template/go/template.yml b/template/go/template.yml deleted file mode 100644 index 7d29bab5..00000000 --- a/template/go/template.yml +++ /dev/null @@ -1,25 +0,0 @@ -language: go -fprocess: ./handler -build_options: - - name: dev - packages: - - make - - automake - - gcc - - g++ - - subversion - - python3-dev - - musl-dev - - libffi-dev - - git - - name: mysql - packages: - - mysql-client - - mysql-dev -welcome_message: | - Warning: this classic Go template has been DEPRECATED and - is being maintained for backwards compatibility reasons only. - - Use the golang-middleware template instead, learn more at: - - See more: https://docs.openfaas.com/cli/templates diff --git a/template/node/.dockerignore b/template/node/.dockerignore deleted file mode 100644 index e84c3fba..00000000 --- a/template/node/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -*/node_modules diff --git a/template/node/Dockerfile b/template/node/Dockerfile deleted file mode 100644 index 05505d04..00000000 --- a/template/node/Dockerfile +++ /dev/null @@ -1,53 +0,0 @@ -FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/classic-watchdog:0.3.1 AS watchdog -FROM --platform=${TARGETPLATFORM:-linux/amd64} node:20-alpine AS ship - -ARG TARGETPLATFORM -ARG BUILDPLATFORM - -COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog -RUN chmod +x /usr/bin/fwatchdog - -RUN addgroup -S app && adduser app -S -G app - -WORKDIR /root/ - -# Turn down the verbosity to default level. -ENV NPM_CONFIG_LOGLEVEL warn - -RUN mkdir -p /home/app - -# Wrapper/boot-strapper -WORKDIR /home/app -COPY package.json ./ - -# This ordering means the npm installation is cached for the outer function handler. -RUN npm i --production - -# Copy outer function handler -COPY index.js ./ - -# COPY function node packages and install, adding this as a separate -# entry allows caching of npm install runtime dependencies -WORKDIR /home/app/function -COPY function/*.json ./ -RUN npm i --production || : - -# Copy in additional function files and folders -COPY --chown=app:app function/ . - -WORKDIR /home/app/ - -# chmod for tmp is for a buildkit issue (@alexellis) -RUN chmod +rx -R ./function \ - && chown app:app -R /home/app \ - && chmod 777 /tmp - -USER app - -ENV cgi_headers="true" -ENV fprocess="node index.js" -EXPOSE 8080 - -HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1 - -CMD ["fwatchdog"] diff --git a/template/node/function/handler.js b/template/node/function/handler.js deleted file mode 100644 index 6df7c5d4..00000000 --- a/template/node/function/handler.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict" - -module.exports = async (context, callback) => { - return {status: "done"} -} diff --git a/template/node/function/package.json b/template/node/function/package.json deleted file mode 100644 index 3d3a3e45..00000000 --- a/template/node/function/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "function", - "version": "1.0.0", - "description": "", - "main": "handler.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC" -} diff --git a/template/node/index.js b/template/node/index.js deleted file mode 100644 index e9189b5e..00000000 --- a/template/node/index.js +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Alex Ellis 2017. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -"use strict" - -const getStdin = require('get-stdin'); - -const handler = require('./function/handler'); - -getStdin().then(val => { - const cb = (err, res) => { - if (err) { - return console.error(err); - } - if (!res) { - return; - } - if(Array.isArray(res) || isObject(res)) { - console.log(JSON.stringify(res)); - } else { - process.stdout.write(res); - } - } // cb ... - - const result = handler(val, cb); - if (result instanceof Promise) { - result - .then(data => cb(undefined, data)) - .catch(err => cb(err, undefined)) - ; - } -}).catch(e => { - console.error(e.stack); -}); - -const isObject = (a) => { - return (!!a) && (a.constructor === Object); -}; \ No newline at end of file diff --git a/template/node/package.json b/template/node/package.json deleted file mode 100644 index 20b327ac..00000000 --- a/template/node/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "node", - "version": "1.0.0", - "description": "", - "main": "faas_index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "get-stdin": "^5.0.1" - } -} diff --git a/template/node/template.yml b/template/node/template.yml deleted file mode 100644 index 905b073b..00000000 --- a/template/node/template.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: node -fprocess: node index.js -welcome_message: | - Warning: this classic node template has been DEPRECATED and - is being maintained for backwards compatibility reasons only. - - Use the node20 template instead, learn more at: - - See more: https://docs.openfaas.com/cli/templates diff --git a/template/python27/Dockerfile b/template/python27/Dockerfile deleted file mode 100644 index c209b9ba..00000000 --- a/template/python27/Dockerfile +++ /dev/null @@ -1,55 +0,0 @@ -FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/classic-watchdog:0.3.1 AS watchdog -FROM --platform=${TARGETPLATFORM:-linux/amd64} python:2.7.18-alpine - -ARG TARGETPLATFORM -ARG BUILDPLATFORM - -# Allows you to add additional packages via build-arg -ARG ADDITIONAL_PACKAGE - -COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog -RUN chmod +x /usr/bin/fwatchdog -RUN apk --no-cache add ca-certificates ${ADDITIONAL_PACKAGE} - -# Add non root user -RUN addgroup -S app && adduser app -S -G app - -WORKDIR /home/app/ - -COPY index.py . -COPY requirements.txt . - -RUN chown -R app /home/app && \ - mkdir -p /home/app/python && chown -R app /home/app -USER app -ENV PATH=$PATH:/home/app/.local/bin:/home/app/python/bin/ -ENV PYTHONPATH=$PYTHONPATH:/home/app/python - -RUN pip install -r requirements.txt --target=/home/app/python - -RUN mkdir -p function -RUN touch ./function/__init__.py - -WORKDIR /home/app/function/ -COPY function/requirements.txt . - -RUN pip install -r requirements.txt --target=/home/app/python - -WORKDIR /home/app/ - -USER root - -COPY function function - -# Allow any user-id for OpenShift users. -RUN chown -R app:app ./ && \ - chmod -R 777 /home/app/python - -USER app - -ENV fprocess="python index.py" -EXPOSE 8080 - -HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1 - -CMD ["fwatchdog"] diff --git a/template/python27/function/handler.py b/template/python27/function/handler.py deleted file mode 100644 index a7098fa5..00000000 --- a/template/python27/function/handler.py +++ /dev/null @@ -1,7 +0,0 @@ -def handle(req): - """handle a request to the function - Args: - req (str): request body - """ - - return req diff --git a/template/python27/function/requirements.txt b/template/python27/function/requirements.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/template/python27/index.py b/template/python27/index.py deleted file mode 100644 index 5c0d24f4..00000000 --- a/template/python27/index.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) Alex Ellis 2017. All rights reserved. -# Copyright (c) OpenFaaS Author(s) 2018. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. - -import sys -from function import handler - -def get_stdin(): - buf = "" - for line in sys.stdin: - buf = buf + line - return buf - -if __name__ == "__main__": - st = get_stdin() - ret = handler.handle(st) - if ret != None: - print(ret) diff --git a/template/python27/requirements.txt b/template/python27/requirements.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/template/python27/template.yml b/template/python27/template.yml deleted file mode 100644 index 55027337..00000000 --- a/template/python27/template.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: python27 -fprocess: python index.py -build_options: - - name: dev - packages: - - make - - automake - - gcc - - g++ - - subversion - - python3-dev - - musl-dev - - libffi-dev - - git - - name: mysql - packages: - - mysql-client - - mysql-dev - - name: pillow - packages: - - jpeg-dev - - zlib-dev - - freetype-dev - - lcms2-dev - - openjpeg-dev - - tiff-dev - - tk-dev - - tcl-dev - - harfbuzz-dev - - fribidi-dev diff --git a/template/python3-debian/Dockerfile b/template/python3-debian/Dockerfile deleted file mode 100644 index d83355e2..00000000 --- a/template/python3-debian/Dockerfile +++ /dev/null @@ -1,58 +0,0 @@ -ARG PYTHON_VERSION=3 -FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/classic-watchdog:0.3.1 AS watchdog -FROM --platform=${TARGETPLATFORM:-linux/amd64} python:${PYTHON_VERSION} - -ARG TARGETPLATFORM -ARG BUILDPLATFORM - -# Allows you to add additional packages via build-arg -ARG ADDITIONAL_PACKAGE - -COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog -RUN chmod +x /usr/bin/fwatchdog -RUN apt-get update \ - && apt-get install -y ca-certificates ${ADDITIONAL_PACKAGE} \ - && rm -rf /var/lib/apt/lists/ - -# Add non root user -RUN groupadd app && useradd -r -g app app - -WORKDIR /home/app/ - -COPY index.py . -COPY requirements.txt . - -RUN chown -R app /home/app && \ - mkdir -p /home/app/python && chown -R app /home/app -USER app -ENV PATH=$PATH:/home/app/.local/bin:/home/app/python/bin/ -ENV PYTHONPATH=$PYTHONPATH:/home/app/python - -RUN pip install -r requirements.txt --target=/home/app/python - -RUN mkdir -p function -RUN touch ./function/__init__.py - -WORKDIR /home/app/function/ -COPY function/requirements.txt . - -RUN pip install -r requirements.txt --target=/home/app/python - -WORKDIR /home/app/ - -USER root - -COPY function function - -# Allow any user-id for OpenShift users. -RUN chown -R app:app ./ && \ - chmod -R 777 /home/app/python - -USER app - -ENV fprocess="python3 index.py" -EXPOSE 8080 - -HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1 - -CMD ["fwatchdog"] diff --git a/template/python3-debian/function/__init__.py b/template/python3-debian/function/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/template/python3-debian/function/handler.py b/template/python3-debian/function/handler.py deleted file mode 100644 index a7098fa5..00000000 --- a/template/python3-debian/function/handler.py +++ /dev/null @@ -1,7 +0,0 @@ -def handle(req): - """handle a request to the function - Args: - req (str): request body - """ - - return req diff --git a/template/python3-debian/function/requirements.txt b/template/python3-debian/function/requirements.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/template/python3-debian/index.py b/template/python3-debian/index.py deleted file mode 100644 index f49caaec..00000000 --- a/template/python3-debian/index.py +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) Alex Ellis 2017. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. - -import sys -from function import handler - -def get_stdin(): - buf = "" - while(True): - line = sys.stdin.readline() - buf += line - if line=="": - break - return buf - -if(__name__ == "__main__"): - st = get_stdin() - ret = handler.handle(st) - if ret != None: - print(ret) diff --git a/template/python3-debian/requirements.txt b/template/python3-debian/requirements.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/template/python3-debian/template.yml b/template/python3-debian/template.yml deleted file mode 100644 index 461193ff..00000000 --- a/template/python3-debian/template.yml +++ /dev/null @@ -1,2 +0,0 @@ -language: python3-debian -fprocess: python3 index.py diff --git a/template/python3/Dockerfile b/template/python3/Dockerfile deleted file mode 100644 index 3c455585..00000000 --- a/template/python3/Dockerfile +++ /dev/null @@ -1,57 +0,0 @@ -ARG PYTHON_VERSION=3 -FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/classic-watchdog:0.3.1 AS watchdog -FROM --platform=${TARGETPLATFORM:-linux/amd64} python:${PYTHON_VERSION}-alpine - -ARG TARGETPLATFORM -ARG BUILDPLATFORM - -# Allows you to add additional packages via build-arg -ARG ADDITIONAL_PACKAGE - -COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog -RUN chmod +x /usr/bin/fwatchdog -RUN apk --no-cache add ca-certificates ${ADDITIONAL_PACKAGE} - - -# Add non root user -RUN addgroup -S app && adduser app -S -G app - -WORKDIR /home/app/ - -COPY index.py . -COPY requirements.txt . - -RUN chown -R app /home/app && \ - mkdir -p /home/app/python && chown -R app /home/app -USER app -ENV PATH=$PATH:/home/app/.local/bin:/home/app/python/bin/ -ENV PYTHONPATH=$PYTHONPATH:/home/app/python - -RUN pip install -r requirements.txt --target=/home/app/python - -RUN mkdir -p function -RUN touch ./function/__init__.py - -WORKDIR /home/app/function/ -COPY function/requirements.txt . - -RUN pip install -r requirements.txt --target=/home/app/python - -WORKDIR /home/app/ - -USER root - -COPY function function - -# Allow any user-id for OpenShift users. -RUN chown -R app:app ./ && \ - chmod -R 777 /home/app/python - -USER app - -ENV fprocess="python3 index.py" -EXPOSE 8080 - -HEALTHCHECK --interval=3s CMD [ -e /tmp/.lock ] || exit 1 - -CMD ["fwatchdog"] diff --git a/template/python3/function/__init__.py b/template/python3/function/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/template/python3/function/handler.py b/template/python3/function/handler.py deleted file mode 100644 index a7098fa5..00000000 --- a/template/python3/function/handler.py +++ /dev/null @@ -1,7 +0,0 @@ -def handle(req): - """handle a request to the function - Args: - req (str): request body - """ - - return req diff --git a/template/python3/function/requirements.txt b/template/python3/function/requirements.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/template/python3/index.py b/template/python3/index.py deleted file mode 100644 index 6e1a22f8..00000000 --- a/template/python3/index.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) Alex Ellis 2017. All rights reserved. -# Copyright (c) OpenFaaS Author(s) 2018. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. - -import sys -from function import handler - -def get_stdin(): - buf = "" - while(True): - line = sys.stdin.readline() - buf += line - if line == "": - break - return buf - -if __name__ == "__main__": - st = get_stdin() - ret = handler.handle(st) - if ret != None: - print(ret) diff --git a/template/python3/requirements.txt b/template/python3/requirements.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/template/python3/template.yml b/template/python3/template.yml deleted file mode 100644 index 5933be96..00000000 --- a/template/python3/template.yml +++ /dev/null @@ -1,37 +0,0 @@ -language: python3 -fprocess: python3 index.py -build_options: - - name: dev - packages: - - make - - automake - - gcc - - g++ - - subversion - - python3-dev - - musl-dev - - libffi-dev - - git - - name: mysql - packages: - - mysql-client - - mysql-dev - - name: pillow - packages: - - jpeg-dev - - zlib-dev - - freetype-dev - - lcms2-dev - - openjpeg-dev - - tiff-dev - - tk-dev - - tcl-dev - - harfbuzz-dev - - fribidi-dev -welcome_message: | - You have created a Python3 function using the Classic Watchdog. - - To include third-party dependencies create a requirements.txt file. - - For high-throughput applications, we recommend using the python3-flask - or python3-http templates. diff --git a/template/ruby/Dockerfile b/template/ruby/Dockerfile deleted file mode 100644 index 1e52db1b..00000000 --- a/template/ruby/Dockerfile +++ /dev/null @@ -1,42 +0,0 @@ -FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/classic-watchdog:0.3.1 AS watchdog -FROM --platform=${TARGETPLATFORM:-linux/amd64} ruby:3.3.6-alpine - -ARG TARGETPLATFORM -ARG BUILDPLATFORM - -COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog -RUN chmod +x /usr/bin/fwatchdog - -ARG ADDITIONAL_PACKAGE - -# Alternatively use ADD https:// (which will not be cached by Docker builder) -RUN apk --no-cache add ${ADDITIONAL_PACKAGE} - -WORKDIR /home/app - -COPY Gemfile . -COPY index.rb . -COPY function function - -RUN bundle install \ - && mkdir -p /home/app/function - -WORKDIR /home/app/function - -RUN bundle install - -RUN addgroup -S app \ - && adduser app -S -G app - -RUN chown app:app -R /home/app - -USER app - -WORKDIR /home/app - -ENV fprocess="ruby index.rb" -EXPOSE 8080 - -HEALTHCHECK --interval=2s CMD [ -e /tmp/.lock ] || exit 1 - -CMD ["fwatchdog"] diff --git a/template/ruby/Gemfile b/template/ruby/Gemfile deleted file mode 100644 index 20b4d4ae..00000000 --- a/template/ruby/Gemfile +++ /dev/null @@ -1 +0,0 @@ -source 'https://rubygems.org' diff --git a/template/ruby/function/Gemfile b/template/ruby/function/Gemfile deleted file mode 100644 index c9721cb6..00000000 --- a/template/ruby/function/Gemfile +++ /dev/null @@ -1,2 +0,0 @@ -source 'https://rubygems.org' - diff --git a/template/ruby/function/handler.rb b/template/ruby/function/handler.rb deleted file mode 100644 index 1c5f146a..00000000 --- a/template/ruby/function/handler.rb +++ /dev/null @@ -1,5 +0,0 @@ -class Handler - def run(req) - return "Hello world from the Ruby template" - end -end diff --git a/template/ruby/index.rb b/template/ruby/index.rb deleted file mode 100644 index 9016c462..00000000 --- a/template/ruby/index.rb +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) Alex Ellis 2017. All rights reserved. -# Copyright (c) OpenFaaS Author(s) 2018. All rights reserved. -# Licensed under the MIT license. See LICENSE file in the project root for full license information. - -require_relative 'function/handler' - -req = ARGF.read - -handler = Handler.new -res = handler.run req - -puts res diff --git a/template/ruby/template.yml b/template/ruby/template.yml deleted file mode 100644 index ab1e5ac3..00000000 --- a/template/ruby/template.yml +++ /dev/null @@ -1,24 +0,0 @@ -language: ruby -fprocess: ruby index.rb -build_options: - - name: dev - packages: - - make - - automake - - gcc - - g++ - - subversion - - python3-dev - - musl-dev - - libffi-dev - - libssh - - libssh-dev -welcome_message: | - - Warning: - This template is deprecated, use the ruby-http template instead. - - You have created a Ruby function using the Classic Watchdog. - - To include third-party dependencies create a Gemfile. You can also - include developer-dependencies using the "dev" build_option.