I am building an image using the following Dockerfile
FROM golang:1.19.2-bullseye as builder
COPY src /src
WORKDIR /src
RUN CGO_ENABLED=1 go build -race -ldflags "-s -w" -o client-go
FROM scratch
COPY --from=builder /src/client-go /client-go
ENTRYPOINT [ "/client-go" ]
and creating the following Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: test-skaffold
name: test-skaffold
spec:
replicas: 1
selector:
matchLabels:
app: test-skaffold
template:
metadata:
creationTimestamp: null
labels:
app: test-skaffold
spec:
containers:
- image: pkaramol/test-skaffold
name: test-skaffold
The deployment is done using skaffold
FWIW.
The process fails as follows:
Waiting for deployments to stabilize...
- deployment/test-skaffold: container test-skaffold terminated with exit code 1
- pod/test-skaffold-c955979f6-ckpqg: container test-skaffold terminated with exit code 1
> [test-skaffold-c955979f6-ckpqg test-skaffold] standard_init_linux.go:228: exec user process caused: no such file or directory
- deployment/test-skaffold failed. Error: container test-skaffold terminated with exit code 1.
What is the failure cause?
Update
Changing the FROM
in the 2nd build stage to ubuntu
fixes things, but why is scratch
failing to find the ENTRYPOINT
?