For a good first shot at the in's and outs of building a bike light i suggest looking at bikeled.org, or googling "diyled"
It's a few years old, but other than the older emitters it still seems like current info. The recommended driver and batteries are still sold and still great.