First, yes, portfolios are a universally good thing for students at any level, not just high school. My preference is to require them and also to provide some institutional support for their creation and maintenance. The initial creation of the portfolio can be a project for a second or third year student - graded or not. If there is a course in web development it might be the natural place for such a project.
Rather than just code, however, I think it is much more important that portfolios showcase student writing and communication skills. A student can describe what they have built and the teams they have contributed to with (English/French/...) prose. If possible, the prose should be checked and edited to be clear and correct - support. If the project was a coding project there can be links to the code, but the primary thing is what the student has to say about the project and its value in their education. "What I learned and why it is important." For a platform, I like a web-page (or several pages), rather than a repository. Any code can be either in a repository or a simple downloaded archive file.
I would also try to provide a platform with which the student work is permanently available - at least several years past graduation. Ideally the former student could add to it. There should be some way to contact the author, possibly indirectly, through the portfolio. For minor students, the contact likely must be indirect, through the institution.
Institutional support is needed (or at least very desirable) to assure high quality and to assist reticent students to bring out their best work. Many students are reluctant to "bring themselves forward" for many reasons: shyness, modesty, ...
On the other side, institutional support (editors say) can help some students "tone down" boastful claims that will be seen as a negative by employers. There is a fairly fine line that students may not always recognize.
The permanence of the portfolio is important for a number of reasons. The student will come to depend on it, of course, but it is also a way for the institution itself to keep in contact with the student (and vise-versa) in the future. This will make it easier to bring back former students to talk to current students and will also help in future fund-raising. Likewise email addresses assigned to students by educational institutions should be treated as permanent - keeping that link alive.
If the portfolio is primarily prose, it is easier to provide institutional support as most schools have professionals already skilled at that, though it takes an institutional decision to provide the support. But it can be considered a positive institutional goal to showcase student works. This is especially true if it aids in recruitment and in bringing employers (and donors) to a school seen as doing a truly fine job.
Note that the book Pedagogical Patterns has a pattern: Student Online Portfolios.