Closed blijblijblij closed 3 years ago
Would this https://github.com/blijblijblij/templates/commit/0edb240db27ef3d62e5eb625f32bc99a304bd0f9 fix the issue?!
Not sure if I understood the templates correctly @alexellis
You need to use a template that is based upon Debian instead of Alpine Linux, which is better suited to pure-Ruby only.
Use the ruby-http one https://github.com/openfaas/ruby-http
Hmm, lots off nuances here, thx for pointing me to ruby-http
@alexellis , after some github actions workflow changes I got it to work, although kubeclient
gem still seems reluctant to install:
https://github.com/blijblijblij/faas-functions/runs/1648922184?check_suite_focus=true
I'll continue my investigation, thx anyway!
Have you checked the installation requirements for kubeclient?
https://rubygems.org/gems/kubeclient/versions/3.0.0 https://github.com/abonas/kubeclient
And does it install locally with faas-cli build
?
OK so you need to add this to your stack.yml file:
build_options:
- dev
https://docs.openfaas.com/reference/yaml/#function-build-options
That built fine for me:
Step 13/23 : RUN bundle install
---> Running in e55f6ecb7162
Fetching gem metadata from https://rubygems.org/........
Resolving dependencies...
Fetching rake 13.0.3
Installing rake 13.0.3
Fetching public_suffix 4.0.6
Installing public_suffix 4.0.6
Fetching addressable 2.7.0
Installing addressable 2.7.0
Using bundler 1.17.2
Fetching unf_ext 0.0.7.7
Installing unf_ext 0.0.7.7 with native extensions
Fetching unf 0.1.4
Installing unf 0.1.4
Fetching domain_name 0.5.20190701
Installing domain_name 0.5.20190701
Fetching ffi 1.14.2
Installing ffi 1.14.2 with native extensions
Fetching ffi-compiler 1.0.1
Installing ffi-compiler 1.0.1
Fetching http-cookie 1.0.3
Installing http-cookie 1.0.3
Fetching http-form_data 2.3.0
Installing http-form_data 2.3.0
Fetching http-parser 1.2.2
Installing http-parser 1.2.2 with native extensions
Fetching http 4.4.1
Installing http 4.4.1
Fetching http-accept 1.7.0
Installing http-accept 1.7.0
Fetching multi_json 1.15.0
Installing multi_json 1.15.0
Fetching jsonpath 1.1.0
Installing jsonpath 1.1.0
Fetching recursive-open-struct 1.1.3
Installing recursive-open-struct 1.1.3
Fetching mime-types-data 3.2020.1104
Installing mime-types-data 3.2020.1104
Fetching mime-types 3.3.1
Installing mime-types 3.3.1
Fetching netrc 0.11.0
Installing netrc 0.11.0
Fetching rest-client 2.1.0
Installing rest-client 2.1.0
Fetching kubeclient 4.9.1
Installing kubeclient 4.9.1
Bundle complete! 2 Gemfile dependencies, 22 gems now installed.
Bundled gems are installed into `/usr/local/bundle`
Removing intermediate container e55f6ecb7162
May I suggest that, if you've found my answers and help useful, that you support our project?
https://github.com/sponsors/openfaas
or
/set title: Support request for native dependencies in ruby
Struggled with editing the stack.yml
build_options:
- dev
Did not work for me, but maybe I placed it in the wrong place, got it to work with ADDITIONAL_PACKAGE
while building with github actions, which conceptionally use the same variables:
...
name: Build and Push the OpenFaaS function
uses: docker/build-push-action@v2
with:
context: ./build/homepage/
file: ./build/homepage/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: |
ADDITIONAL_PACKAGE=build-essential
tags: |
blijblijblij/homepage:latest-${{ steps.define_env.outputs.github-sha-short }}
blijblijblij/homepage:latest
...
Now it works, thanks for your kind help @alexellis
May I suggest that, if you've found my answers and help useful, that you support our project?
https://github.com/sponsors/openfaas
or
Been there, done that, thanks and keep up the good work! 🚀 🎆
You cannot use faas-cli build
with docker/build-push-action@v2
- it's mutually exclusive.
faas-cli build
generates a docker build
command, and docker/build-push-action@v2
creates its own docker build command, so you've done the right thing for your CI, if you need it to be multi-arch.
For local development, you need to use the stack.yml approach and faas-cli build
, or for multi-arch faas-cli publish
Thanks for the support.
When adding a gem that needs extensions to be natively build the
ruby:alpine
image seems to be a bit to lightweight and can not build the gems defined within the Gemfile:Expected Behaviour
Current Behaviour
Possible Solution
Some github issues mention similar issues, which should be fixed by adding
to the Dockerfile
Steps to Reproduce (for bugs)
Context
I am trying to get ruby functions to run on a k3s cluster using openfaas, but just before the finishline my code cannot be wrapped into a container, thus my experimentations are on hold because of it.
Your Environment
docker version
(e.g. Docker 17.0.05 ):Server: Docker Engine - Community Engine: Version: 20.10.1 API version: 1.41 (minimum version 1.12) Go version: go1.13.15 Git commit: f001486 Built: Tue Dec 15 04:33:03 2020 OS/Arch: linux/arm64 Experimental: false containerd: Version: 1.4.3 GitCommit: 269548fa27e0089a8b8278fc4fc781d7f65a939b runc: Version: 1.0.0-rc92 GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff docker-init: Version: 0.19.0 GitCommit: de40ad0