openfaas / openfaas/faas-cli

faas-cli using buildkit and / or --cache-from Docker options for CI build process optimization

Open
#842 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
816
Forks
230
Avg merge
6h 4m
Merged PRs (30d)
1

Description

My actions before raising this issue

How to use buildkit cache optimization in combination with --cache-from argument option to accelerate the build with faas-cli in a CI pipeline (I am trying it with Github actions)

Expected Behaviour

Use remote registry cached layers to build only the necessary changes and not the whole image each time the build process is launched from faas-cli in a CI pipeline

Current Behaviour

The image is built from scratch which takes quite some time.

Possible Solution

Allow --cache-from argument and buildkit

Steps to mimic Reproduce (for bugs)

  1. docker build -t myname/myapp --build-arg BUILDKIT_INLINE_CACHE=1 .
  2. docker push myname/myapp
  3. docker build --cache-from myname/myapp .

Source : Specifying external cache sources

Context

In a CI process like Github action the Docker image build process is not using (by default for what I could check) any cache so the image is built from the ground.
As my openfaas functions are using pandas python library some steps in the docker build process are taking a very long time.
But those layers are not changing frequently, so locally on the workstation as the cache is used the build process is fast but not on the CI pipeline as all the layers are rebuilt.

Your Environment

  • FaaS-CLI version ( Full output from: faas-cli version ): 0.12.14

  • Docker version docker version (e.g. Docker 17.0.05 ): Github action Docker version so I am not sure exactly

  • Are you using Docker Swarm or Kubernetes (FaaS-netes)? Target is Kubernetes but it doesn't matter here I guess

  • Operating System and version (e.g. Linux, Windows, MacOS): Github CI

  • Code example or link to GitHub repo or gist to reproduce problem:

  • Other diagnostic information / logs from troubleshooting guide

If using Swarm, run the following and include the output:

curl -sLS https://raw.githubusercontent.com/moby/moby/master/contrib/check-config.sh | bash

Next steps

You may join Slack for community support.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing faas-cli's Docker build path and comparing it with the issue's three docker build commands and GitHub Actions context. Done should mean that faas-cli can use BuildKit and a remote --cache-from source so unchanged image layers are reused in CI.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, github-actions, go
Domain
build-system, ci-cd, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.