It's not ideal, but it's perfectly ok to vent a dryer out through the roof. You'll need to install a flashing piece in the roof similar to a boot for plumbing vents, but the vent you want is sheet metal with a hood to protect from weather and a self-closing vent flap.
You might also see if you can run the venting horizontally across the attic floor and exit through a soffit or facia.
Wherever you do choose to run the vent pipe in the attic, make sure you insulate it so the warm air inside the vent doesn't cause condensation outside the vent, which could result in "leaks" in your ceiling.
You definitely do not want to put all that warm, moist air into your attic. It will cause mold, mildew and ruin your insulation.