Skip to content

Misconfigured multi-stage step name in all Dockerfiles #63

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

Closed
3 tasks done
atlas-wheatear opened this issue Oct 5, 2022 · 3 comments
Closed
3 tasks done

Misconfigured multi-stage step name in all Dockerfiles #63

atlas-wheatear opened this issue Oct 5, 2022 · 3 comments

Comments

@atlas-wheatear
Copy link

My actions before raising this issue

Expected Behaviour

The faas-cli build, having pulled the most recent templates for python3-http as of the last 30 minutes, should continue to build as it did earlier today.
(There could be a problem my end, but it's failing on my local M1 Macbook Pro and my GitLab instance.)
Functions I haven't modified at all in days are also failing redeployment.

Current Behaviour

It fails, seemingly because it is trying to pull from a remote "builder" image on Docker Hub, as opposed to using the builder "stage" of the multi-stage build. Error below:

#3 [internal] load metadata for docker.io/library/builder:latest
#3 sha256:261eb3ef077559ec61986b2391905264393ea6320a9bca56ed4d427da6e7cb59
#3 ERROR: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
------
 > [internal] load metadata for docker.io/library/builder:latest:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed

Possible Solution

Explicitly label the previous stage as builder? I'm actually stumped as to why this has broken just now, perhaps due to a breaking of compatibility introduced by using the --platform flag?

FROM --platform=${TARGETPLATFORM:-linux/amd64} python:3.7-alpine

Steps to Reproduce (for bugs)

  1. using this code https://github.com/emoulsdale/openfaas-test (sorry, it's really bad and unidiomatic)
  2. run faas-cli template store pull python3-http
  3. run faas-cli build
  4. observe this error appear!

Context

My test functions are no longer building with the newest templates at all. Sorry to be a pain :) . I can revert back to the previous version for now though! Will have to check it in to my code manually, and alter the CI scripts.

Your Environment

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

  • Docker version docker version (e.g. Docker 17.0.05 ):
    Docker version 20.10.13, build a224086

  • Are you using Docker Swarm or Kubernetes (FaaS-netes)?
    Kubernetes

  • Operating System and version (e.g. Linux, Windows, MacOS):
    MacOS with M1 Pro

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

  • Other diagnostic information / logs from troubleshooting guide

https://github.com/emoulsdale/openfaas-test

Next steps

You may join Slack for community support.

Just wanted to add that this still only the first problem I've had, so far, after months of trying silly things. I am really enjoying sponsoring this project!

@atlas-wheatear
Copy link
Author

I found a previous version of the Dockerfile in the python3-http template, stored (locally, it's gitignored) in one of my function repos.

Using this local previous version, my functions are still building on my local MacBook.

Here is the diff (from previous to current).

1,2c1,2
< FROM ghcr.io/openfaas/of-watchdog:0.9.6 as watchdog
< FROM python:3.7-alpine
---
> FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/of-watchdog:0.9.8 as watchdog
> FROM --platform=${TARGETPLATFORM:-linux/amd64} python:3.7-alpine
22,23c22,23
< COPY index.py           .
< COPY requirements.txt   .
---
> COPY --chown=app:app index.py           .
> COPY --chown=app:app requirements.txt   .
25c25
< RUN pip install -r requirements.txt
---
> RUN pip install --no-cache-dir -r requirements.txt
33,34c33,34
< COPY function/requirements.txt	.
< RUN pip install --user -r requirements.txt
---
> COPY --chown=app:app function/requirements.txt	.
> RUN pip install --no-cache-dir --user -r requirements.txt
36c36
< #install function code
---
> # install function code
38,39c38
< COPY function/   .
< RUN chown -R app:app ../
---
> COPY --chown=app:app function/   .
40a40
> FROM builder as tester
44a45
> FROM builder as final
47c48
< #configure WSGI server and healthcheck
---
> # configure WSGI server and healthcheck

@alexellis
Copy link
Member

alexellis commented Oct 5, 2022

Sorry for the inconvenience. We are not sure who you are and how you use OpenFaaS as we don't have your company as a sponsor or the ADOPTERS file

We'll look into supporting you here, perhaps consider doing one of the above to reciprocate the goodwill.

Alex

@alexellis
Copy link
Member

alexellis commented Oct 5, 2022

I can reproduce the problem with:

faas-cli new --lang python3-http testbuild
faas-cli build -f testbuild.yml 

@LucasRoesler I think it may be related to recent changes we've made to the Python template.

I've pushed bf6afb7 as a fix.

Perhaps we should get the e2e test from the openfaas/templates repo over here and run it as GitHub Action?

https://github.com/openfaas/templates/blob/master/verify.sh
https://github.com/openfaas/templates/blob/master/.github/workflows/only-ci.yaml

@alexellis alexellis changed the title faas-cli tries to pull builder image instead of using previous builder stage Misconfigured multi-stage step name in all Dockerfiles Oct 5, 2022
jpauwels pushed a commit to jpauwels/python-flask-template that referenced this issue Apr 15, 2023
Fixes: openfaas#63 - introduced via openfaas#62

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
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