append_source_to_docker_file, refactored and tested