docker: Fix DockerHub auth when using ECR

Olav Morken requested to merge fix-dockerhub-ratelimit-ecr into master

The code was written to not do any authentication to DockerHub when using Amazon Elastic Container Registry. This causes pipeline to fail due to ratelimiting on DockerHub.

Restructure the code to always authenticate to DockerHub, even if we are going to push the image to Amazon ECR.

Merge request reports