Unfortunately if you're running the container as a publicly routable container it will always update the public IP address of the container whenever you update the task definition.
There is currently no support for elastic IP addresses in Fargate, which would be the solution you're looking for.
I would suggest if keeping the IP address is required that you look at re architecting your solution to the following:
- Public facing Network Load Balancer with a static IP address
- Fargate containers register to a target group of the Network Load Balancer.
Remember that if you had any kind of failure at the moment this might also cause your container to lose its IP address.