I just create a dockerfile for postgres using multi-step distroless image. I try to learn distroless because of security and size of the image. here's my dockerfile:
### First Stage ###
# Base Image
FROM postgres:13-alpine as build
WORKDIR /usr/src/app/postgres
### Second Stage ###
FROM gcr.io/distroless/base-debian10
COPY --from=build /usr/src/app/postgres /usr/src/app/postgres
WORKDIR /usr/src/app/postgres
# Change user to non-root
USER 1002
# Run POSTGRES
CMD ["/postgres"]
After building the image the end result is 4 images instead of 1 like image below
I'm new to docker and as far as I know 1 dockerfile should result in 1 images, can anyone explain why this is happened?