1. Run automated tests during container build (maybe in the AfterBuildSuccess step)
2. Have a single image that goes to both staging and production. Pass in environment variables or configs to operate the image differently in staging or prod
3. Don't include test dependencies in the image so the image is smaller. So if you're running tests etc don't add the tests and dependencies in the Dockerfile. Instead have your CI system run the tests.