The discovery of superconductivity in twisted bilayer graphene has triggered a resurgence of interest in flat-band superconductivity. Here, we investigate the square-octagon lattice, which also exhibits two perfectly flat bands when next-nearest neighbour hopping or an external magnetic field are added to the system. We calculate the superconducting phase diagram in the presence of on-site attractive interactions and find two superconducting domes, as observed in several types of unconventional superconductors. The critical temperature shows a linear dependence on the coupling constant, suggesting that superconductivity might reach high temperatures in the squareoctagon lattice. Our model could be experimentally realized using photonic or ultracold atoms lattices.