How to serve a amp template

I think you need to have another look at the AMP documentation. You simply have to include the link to the AMP version of the article in the header of the post.

<link rel="amphtml" href="http://www.example.com/post-slug/?amp" />

After Google recognizes your posts have AMP versions it will automatically serve the AMP version for you.

Also, this is a great tool I have used in the past to help validate your AMP markup: https://validator.ampproject.org