Snapcraft 7 in docker

Hi, I’ve been trying to upgrade my docker file to have snapcraft 7. I referenced this file to create the image:

FROM download-snap AS snapcraft-snap
RUN /tmp/ snapcraft 7.x/stable "$TARGETPLATFORM" /snap/snapcraft/current

RUN unlink /snap/snapcraft/current/usr/bin/python3
RUN ln -s /snap/snapcraft/current/usr/bin/python3.* /snap/snapcraft/current/usr/bin/python3
RUN echo /snap/snapcraft/current/lib/python3.*/site-packages >> /snap/snapcraft/current/usr/lib/python3/dist-packages/site-packages.pth

RUN mkdir -p /snap/bin
RUN echo "#!/bin/sh" > /snap/bin/snapcraft
RUN snap_version="$(awk '/^version:/{print $2}' /snap/snapcraft/current/meta/snap.yaml | tr -d \')" && echo "export SNAP_VERSION=\"$snap_version\"" >> /snap/bin/snapcraft
RUN echo 'exec "$SNAP/usr/bin/python3" "$SNAP/bin/snapcraft" "$@"' >> /snap/bin/snapcraft
RUN chmod +x /snap/bin/snapcraft

COPY --from=snapcraft-snap /snap/snapcraft/current /snap/snapcraft/current
COPY --from=snapcraft-snap /snap/bin/snapcraft /snap/bin/snapcraft

FROM base AS snapcraft
ENV SNAP="/snap/snapcraft/current"
ENV SNAP_NAME="snapcraft"
ENV PATH "${PATH}:/snap/bin:/snap/snapcraft/current/usr/bin:/usr/local/rust/bin"

I copied the relevant snippets from my code. And snapcraft itself runs. But the issue I am running is in the final stages of my build I am getting this error:

Executing parts lifecycle: build playlist
Executing action
:: + craftctl default
:: /bin/bash: line 51: craftctl: command not found
'override-build' in part 'playlist' failed with code 127.

How I can debug this issue? never seen anything similar before.