Docker ignores step for same image name

I am new to docker, to understand i am trying to build a simple image, but in my case some of the steps in build is ignored if I use the same image name again.

I am sure i am doing it wrong, but just don’t understand why this is happening.

below is the dockerfile

FROM ubuntu AS base
COPY ./runner1/data /app

FROM base
COPY ./runner1/dep /app

FROM base AS final
COPY ./runner1/sample.sh /app/sample.sh
RUN chmod u+x /app/sample.sh
ENTRYPOINT [ "sh", "/app/sample.sh" ]
Building runner1
Step 1/8 : FROM ubuntu AS base
 ---> 94e814e2efa8
Step 2/8 : COPY ./runner1/data /app
 ---> Using cache
 ---> 675aabaf1cc0

Step 3/8 : FROM base
 ---> 675aabaf1cc0
Step 4/8 : COPY ./runner1/dep /app
 ---> Using cache
 ---> dcd1a390efd3

Step 5/8 : FROM base AS final
 ---> 675aabaf1cc0
Step 6/8 : COPY ./runner1/sample.sh /app/sample.sh
 ---> Using cache
 ---> 99b286322a7c
Step 7/8 : RUN chmod u+x /app/sample.sh
 ---> Using cache
 ---> 3599903cb1b8
Step 8/8 : ENTRYPOINT [ "sh", "/app/sample.sh" ]
 ---> Using cache
 ---> 977e3379ab8c

Successfully built 977e3379ab8c
Successfully tagged sampleimage_runner1:latest

When this is run, I see only /app/data folder copied from image ‘675aabaf1cc0’, image ‘dcd1a390efd3’ from step 3,4 appears to be ignored.

Source: StackOverflow