US District Judge Gonzalo Curiel has ruled against an environmental challenge to President Trump's proposed border wall.