Giter Site home page Giter Site logo

cash-machine's Introduction

build docker

Motivation

Just a playground project to explore the Rust programming language and OpenFaaS. Since I'm quite used to C++, I wanted to find out the advantages of Rust. Furthermore, I'm concerned about size of docker images in real world projects and I would like to find ways to implement features in languages providing a sufficient ecosystem but keeping the image size of the increasing number of docker images as small as possible.

What it does?

Takes an amount of money as an argument and calculates the notes to be paid out to the customer (without any practical use, just to play).

Requirements

Deploy to local k8s cluster hosting OpenFaaS and running on RasberryPis

Since multi-platform builds are not yet supported right now (openfaas/faas-cli#770), we have to build and deploy the function in multiple steps. Build image locally to ensure faas-cli copies the template stuff to the right places.

faas-cli build --shrinkwrap -f cash-machine.yml

Build images for amd64, arm64, arm/v7 and push them.

pushd build/cash-machine
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t karlheinzkurt/cash-machine:latest --push .
popd

Deploy function to local cluster, while 192.168.23.10 is the IPv4 of my local cluster and should be changed properly.

export OPENFAAS_URL=http://192.168.23.10:31112
faas-cli deploy -f cash-machine.yml

Use the function.

curl -s http://192.168.23.10:31112/function/cash-machine -d '{"amount":188}' | json_pp
{
   "notes" : {
      "1" : 1,
      "50" : 1,
      "5" : 1,
      "20" : 1,
      "2" : 1,
      "10" : 1,
      "100" : 1
   }
}

TODOs

OpenFaaS helper

k3s helper

Clean-up docker images

sudo k3s crictl images
sudo k3s crictl rmi --prune

cash-machine's People

Contributors

karlheinzkurt avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.