Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature - buildpack support in faas-cli build #834

Closed
alexellis opened this issue Oct 16, 2020 · 3 comments
Closed

Feature - buildpack support in faas-cli build #834

alexellis opened this issue Oct 16, 2020 · 3 comments

Comments

@alexellis
Copy link
Member

alexellis commented Oct 16, 2020

Description

Feature - buildpack support in faas-cli build

Context

DigitalOcean's AppPlatform, Cloudrun, Heroku, Cloudfoundary, Waypoint all support buildpacks

build packs can generally be inferred automatically, and don't need a Dockerfile

An example for Golang would be the follow:

package main

import (
	"log"
	"net/http"
	"os"
)

func main() {

	port := "8080"
	if val, _ := os.LookupEnv("PORT"); len(val) > 0 {
		port = val
	}

	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte("Invoked"))
	})
	http.HandleFunc("/_/healthz", func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte("OK"))
	})

	log.Printf("listening on %s\n", port)
	err := http.ListenAndServe(":"+port, nil)
	if err != nil {
		panic(err)
	}
}

An example of building this would be:

pack build go-mod --builder gcr.io/buildpacks/builder:v1

We could generate this command like we do for faas-cli build. The push and deploy commands would stay the same.

The format for specifying a build pack could be the following where the lang is a buildpack builder i.e. gcr.io/buildpacks/builder:v1 - the / is how we can determine to run pack build instead of docker build

version: 1.0
provider:
  name: openfaas
  gateway: http://127.0.0.1:8080
functions:
  go-mod-app:
    lang: gcr.io/buildpacks/builder:v1
    handler: ./go-mod-app
    image: go-mod-app:latest

I don't see much for us to lose by trying this out as an experiment, if it doesn't get traction, and becomes a burden then it can be removed.

@alexellis
Copy link
Member Author

@yankeexe can you please ask upstream about an ARM release binary on "pack"? cc alexellis/arkade#231

@yankeexe
Copy link
Contributor

@alexellis Link to issue: buildpacks/pack#907

@alexellis
Copy link
Member Author

Closing due to lack of interest from community.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants