The 20 year old, who spent a number of years at Wolverhampton Wanderers, has been capped at Under 21 level by the Republic of Ireland.
Dunleavy, a right back who can also play in midfield, said he was delighted to have joined the club.
Dunleavy had been training with Finn Harps and there was some reports that he may have been on the verge of joining Derry City.
“I can’t wait to get started now. I came down before Christmas to have a look around and I was very impressed with Tommy and with everything I saw down here.”
“I have played with Gearoid Morrissey at international level in the past, and I know that he is a very good player, so I’m looking forward to linking up with him again.
“I’m hoping to play as many games as I can in the coming season and do as well as I can for Cork City. Obviously coming up from the First Division, we want to push on and see how well we can do in the league.”
City boss Tommy Dunne said he was very pleased to have signed the 20 year old.
“John is a right back but can play right across the back four and in the centre of midfield, so he is versatile which gives us options.”
“We will not have a huge squad, so that versatility will be a bonus. He is a good pro who has been highly recommended by his peers and by top managers, so we are delighted to have him on board.”
“John was at Wolves as a professional for a number of years, and when I spoke with Mick McCarthy, he recommended him very highly.
“He is a young gifted player which bodes well for the future, so we are delighted to sign him. I know he is rearing to go and hopefully he will have a successful time here with Cork City.”