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

Fix the possible stuck phenomenon when pack build hello-world-python on MacOS m2 chip #143

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions functions/knative/hello-world-python/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# New gcp-builder builder for MacOS m2 chip
FROM openfunction/gcp-builder:v1

# Unzip package lifecycle-v0.13.2+linux.arm64.tgz and download it from https://github.com/buildpacks/lifecycle/releases?q=0.13.2&expanded=true
COPY ./lifecycle /cnb/lifecycle

# Upgrade lifycycle image version to 0.13.2
LABEL io.buildpacks.builder.metadata="{\"description\":\"Ubuntu 18 base image with buildpacks for .NET, Go, Java, Node.js, and Python\",\"buildpacks\":[{\"id\":\"google.config.entrypoint\",\"name\":\"Config - Entrypoint\",\"version\":\"0.9.0\"},{\"id\":\"google.cpp.clear_source\",\"name\":\"C++ - Clear Source\",\"version\":\"0.1.0\"},{\"id\":\"google.cpp.functions-framework\",\"name\":\"C++ - Functions Framework\",\"version\":\"0.1.0\"},{\"id\":\"google.go.clear_source\",\"name\":\"Go - Clear Source\",\"version\":\"0.9.0\"},{\"id\":\"google.dotnet.runtime\",\"name\":\".NET - Runtime\",\"version\":\"0.9.1\"},{\"id\":\"google.dotnet.publish\",\"name\":\".NET - Publish\",\"version\":\"0.9.0\"},{\"id\":\"google.dotnet.functions-framework\",\"name\":\".NET - Functions Framework\",\"version\":\"0.0.1\"},{\"id\":\"google.go.runtime\",\"name\":\"Go - Runtime\",\"version\":\"0.9.1\"},{\"id\":\"google.go.build\",\"name\":\"Go - Build\",\"version\":\"0.9.0\"},{\"id\":\"google.go.gopath\",\"name\":\"Go - Gopath\",\"version\":\"0.9.0\"},{\"id\":\"google.go.functions-framework\",\"name\":\"Go - Functions Framework\",\"version\":\"0.9.4\"},{\"id\":\"google.java.entrypoint\",\"name\":\"Java - Entrypoint\",\"version\":\"0.9.0\"},{\"id\":\"google.java.exploded-jar\",\"name\":\"Java - Exploded Jar\",\"version\":\"0.9.0\"},{\"id\":\"google.java.functions-framework\",\"name\":\"Java - Functions Framework Invoker\",\"version\":\"1.0.1\"},{\"id\":\"google.java.gradle\",\"name\":\"Java - Gradle\",\"version\":\"0.9.0\"},{\"id\":\"google.java.maven\",\"name\":\"Java - Maven\",\"version\":\"0.9.0\"},{\"id\":\"google.java.runtime\",\"name\":\"Java - Runtime\",\"version\":\"0.9.1\"},{\"id\":\"google.java.clear_source\",\"name\":\"Java - Clear Source\",\"version\":\"0.9.0\"},{\"id\":\"google.nodejs.runtime\",\"name\":\"Node.js - Runtime\",\"version\":\"0.9.2\"},{\"id\":\"google.nodejs.npm\",\"name\":\"Node.js - NPM\",\"version\":\"0.9.0\"},{\"id\":\"google.nodejs.yarn\",\"name\":\"Node.js - Yarn\",\"version\":\"0.9.0\"},{\"id\":\"google.nodejs.functions-framework\",\"name\":\"Node.js - Functions Framework\",\"version\":\"0.9.1\"},{\"id\":\"google.python.runtime\",\"name\":\"Python - Runtime\",\"version\":\"0.9.1\"},{\"id\":\"google.python.pip\",\"name\":\"Python - pip\",\"version\":\"0.9.2\"},{\"id\":\"google.python.functions-framework\",\"name\":\"Python - Functions Framework\",\"version\":\"0.9.4\"},{\"id\":\"google.python.missing-entrypoint\",\"name\":\"Python - pip\",\"version\":\"0.9.0\"},{\"id\":\"google.utils.label\",\"name\":\"Utils - Label Image\",\"version\":\"0.0.1\"}],\"stack\":{\"runImage\":{\"image\":\"openfunction/buildpacks-gcp-run:v1\",\"mirrors\":null}},\"lifecycle\":{\"version\":\"0.13.2\",\"api\":{\"buildpack\":\"0.2\",\"platform\":\"0.3\"},\"apis\":{\"buildpack\":{\"deprecated\":[],\"supported\":[\"0.2\",\"0.3\",\"0.4\",\"0.5\",\"0.6\",\"0.7\",\"0.8\",\"0.9\",\"0.10\"]},\"platform\":{\"deprecated\":[],\"supported\":[\"0.3\",\"0.4\",\"0.5\",\"0.6\",\"0.7\",\"0.8\",\"0.9\",\"0.10\",\"0.11\",\"0.12\"]}}},\"createdBy\":{\"name\":\"Pack CLI\",\"version\":\"0.18.1+git-b5c1a96.build-2373\"}}"

# build
# docker build -t <your dockerhub account>/openfunction-gcp-builder:v1 .

# push image
# docker push <your dockerhub account>/openfunction-gcp-builder:v1

# run build pack
# pack build python-sample --builder <your dockerhub account>/openfunction-gcp-builder:v1 --env GOOGLE_FUNCTION_TARGET=hello_world --verbose
9 changes: 9 additions & 0 deletions functions/knative/hello-world-python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ Build the function locally
pack build python-sample --builder openfunction/gcp-builder:v1 --env GOOGLE_FUNCTION_TARGET=hello_world
```

The builder image used above may not be suitable for the MacOS m2 chip (Arm) architecture. For solutions, please refer to [Dockerfile](./Dockerfile) and then you can use the newly built builder image like:
```sh
pack build python-sample --builder <your dockerhub account>/openfunction-gcp-builder:v1 --env GOOGLE_FUNCTION_TARGET=hello_world
```
If it is just for research use, you can also use the image created by @ToviHe `hetovi1997/openfunction-gcp-builder:v1`




Run the function

```sh
Expand Down