Sunshine
(2007)

On their way to the sun, Icarus 2 discovers the whereabouts of Icarus 1. At Capa’s suggestion, they head towards it to retrieve its payload. In readjusting their course, they inflict damage to their shields, and Captain Kaneda sacrifices himself to make sure they’re repaired, but the oxygen garden is destroyed in the process. Unbeknownst to everyone, Pinbacker, the captain of the Icarus 1, the previous mission, has been living alone on the ship communing with the sun and waiting for it to die. When the Icarus 2 docks with Icarus 1 (now also in order to retrieve its supply of oxygen), Pinbacker gets onto the Icarus 2 and starts to sabotage it like he did his own ship to prevent either from saving the sun. Eventually, everyone left dies in order to bring the payload into the sun. The ending is ambiguous but seems to indicate that the mission succeeded.

The crew dies in this order:

Thanks Jon S!