openfaas / templates

OpenFaaS Classic templates
https://www.openfaas.com
MIT License
278 stars 227 forks source link

hi there,i'm trying to build a image based on arm64,but i failed,could you tell me how to solve it? #275

Closed cryLuantic closed 2 years ago

cryLuantic commented 2 years ago

my command :faas-cli build -f ./add.yml

my response code:

[0] > Building add. Clearing temporary build folder: ./build/add/ Preparing: ./add/ build/add/function Building: myw/add:latest with python template. Please wait.. Sending build context to Docker daemon 8.192kB Step 1/31 : FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/classic-watchdog:0.2.0 as watchdog ---> 6f97aa96da81 Step 2/31 : FROM --platform=${TARGETPLATFORM:-linux/amd64} python:2.7-alpine ---> 8579e446340f Step 3/31 : ARG TARGETPLATFORM ---> Using cache ---> a75f5a062540 Step 4/31 : ARG BUILDPLATFORM ---> Using cache ---> c90a8309e851 Step 5/31 : ARG ADDITIONAL_PACKAGE ---> Using cache ---> 4ee3e6fab2a3 Step 6/31 : COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog ---> Using cache ---> 33d972637c65 Step 7/31 : RUN chmod +x /usr/bin/fwatchdog ---> Running in 6204e8546454 standard_init_linux.go:219: exec user process caused: exec format error The command '/bin/sh -c chmod +x /usr/bin/fwatchdog' returned a non-zero code: 1 [0] < Building add done in 0.54s. [0] Worker done.

Total build time: 0.54s Errors received during build:

my base architecture:arm64

sorry for my stupied question

LucasRoesler commented 2 years ago

@cryLuantic could you fill out the original issue template, there is some important information that you skipped that we need to really help you. See here: https://github.com/openfaas/templates/blob/master/.github/ISSUE_TEMPLATE.md

From the information you shared, it looks like you may be trying to build an arm64 image from an amd/intel based machine, or vice versa

This line in particular seems to suggest that docker is using the wrong target platform

standard_init_linux.go:219: exec user process caused: exec format error

typically docker is supposed to automatically pass these values as build-args when it starts the build

cryLuantic commented 2 years ago

thank you Lucas,i have build my image wtih arm successfully,but now i have a another question with openfaas. i want to scale my function to zero casue i want to test the cold start time, but i found my function always keep 1 copy So what should i do ,is this feature only for openfaas pro?

------------------ 原始邮件 ------------------ 发件人: "openfaas/templates" @.>; 发送时间: 2022年2月17日(星期四) 凌晨1:05 @.>; @.**@.>; 主题: Re: [openfaas/templates] hi there,i'm trying to build a image based on arm64,but i failed,could you tell me how to solve it? (Issue #275)

@cryLuantic could you fill out the original issue template, there is some important information that you skipped that we need to really help you. See here: https://github.com/openfaas/templates/blob/master/.github/ISSUE_TEMPLATE.md

From the information you shared, it looks like you may be trying to build an arm64 image from an amd/intel based machine, or vice versa

This line in particular seems to suggest that docker is using the wrong target platform standard_init_linux.go:219: exec user process caused: exec format error
typically docker is supposed to automatically pass these values as build-args when it starts the build

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

LucasRoesler commented 2 years ago

Scale to zero is a pro feature (has been for ~1 year or so)

But if you only want to test how cold start behaves, you can mimic scale from zero by manually scaling your function using kubectl.

kubectl scale "deploy/$FUNCTION_NAME" --replicas=0
LucasRoesler commented 2 years ago

/close