Check building on `` or local machine, then execute corresponding code


I am in China, I need create a docker image with custom apt-get source ,pip source and so on.? (Because of GFW in China, default source is usually unreachable or very very slow )

I write a Dockfile here

Local building is fine, but can not build on for a long time, detail
Looks like some network error.

I only want to use one Dockerfile to support Local building and dockerhub host. So is there any way to check if building in or local and execute corresponding code? Such as, when build in, update source at last .