RAR/7Z is irrelevant, since they compress with an incompatible compression algorithm.
zip compressors need to be played with until they put the mimetype first, in addition to not doing something stupid and compressing it (which should actually lead to it becoming
larger).
...
Didn't I mention
advzip? It can recompress zipfiles with the
zopfli algorithm, and it is confirmed to be safe to use on existing valid EPUBs.