Also if you're considering potting, you're probably much better served by a circular M8 or M12 connector and cables. Cables are available as standard products, between various ends including to 8p8c.
Your first option should be a sealed (IP65+) enclosure with bulkhead connectors. Circular or sealed 8p8c ("RJ45") connectors can be used. If condensation or leakage can occur inside the box, then conformal coating should be considered. If that is insufficient, finally, potting should be used.
Note that potting serves two primary purposes: physically occupying space so that liquid water cannot condense, and supporting the contents mechanically. A flexible material is generally preferred, to avoid stressing the components. Hard epoxy is likely to shear components completely off the board. There are soft epoxies, or silicone or urethane compounds. The choice depends on desired durometer (rubber firmness), thermal conductivity, chemical compatibility, etc.
Tim