The word 'but' is equivalent to 'just' or 'only'. The phrase means "Life is just a dream".
You will come across this adverbial meaning of 'but' quite often in older and more formal contexts. For example, if you see a film set in the 19th century, you might hear the phrase "He is but a child", meaning "He is just a child" (not an adult).
Either of your interpretations of 'dream' would be correct.