Old version of code showing up in docker container

I think I’m doing something silly but can’t figure out what. I have a docker file for a simple python flask app (like below). When I build the container and then run it, I see that an old copy of my code is being run in the flask app. My git repo doesn’t have any branches so it’s unlikely to have been that. I also have made sure to delete the previous docker images by running the command docker image rm -f DOCKERTAG. Also have done docker prune for cleanup. But still after docker image is built and run, I see an older version of code. As I type this, I’m wondering if the github token would be tied to old version but that’d make no sense. Please help. For clarity, these are my build and run commands. I can also confirm that the issue is with git clone since the app runs with latest code when RUN git clone.... code is replaced with COPY ./ in the dockerfile.

docker image build -t XYZ .

docker container run -p 5000:5000 XYZ

FROM python:3.6
RUN apt-get update
RUN apt-get install -y git
RUN git clone https://[email protected]/GITHUBACCOUNT/MYREPO
WORKDIR /translator-be
RUN pip install -r requirements.txt
EXPOSE 5000
ENTRYPOINT ["python"]
CMD ["app/app.py"]

Source: Docker Questions