Skip to content

devndive/coding-with-gh-copilot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

welcome to coding with github copilot ✨

what is this repository?

Play around with GH Copilot and learn it's capabilities.

pre-requisites

  1. create a github account
  2. get access to github copilot
    1. microsofties can request access to gh copilot here
    2. everyone else can buy a licence here (it's free for students + teachers!)
  3. setup
    1. gh codespaces
      1. in this github repository click on code & create codespace on main create codespaces on main
    2. local
      1. install the needed extensions for your ide
        1. vscode
        2. visual studio
        3. jetbrains ides
      2. install everything needed on your local pc (but not today - we use gh codespaces!)

tasks

warm-up (use copilot inline): building an API with Python and Flask

  1. create an API endpoint that returns a menu with at least 5 items

  2. create an endpoint to create an order. The API should return the total price

  3. copy the following code

@app.route('/menu/<string:id>')
def participants(item_id): 
    connect = sqlite3.connect('database.db') 
    cursor = connect.cursor() 
    cursor.execute('SELECT * FROM menu WHERE id =' + item_id + ';')
  
    data = cursor.fetchall()

    return jsonify({'status': data}) 

to your code, select it and ask copilot chat if there are any issues with it.

  1. create a Dockerfile

tip: if you do not know how to do something, just ask github copilot chat for help :)

main tasks (use github copilot chat): deployment

  1. open the az-deploy.sh and create an azure deployment for your app with azure cli
    1. create a resource group
    2. create an azure container registry
    3. get the ID for the container registry and store it in a variable
    4. build a container image with the container registry
    5. create a managed identity
    6. get the id of the managed identity and store it in a variable
    7. get the clientId of the managed identity and store it in a variable
    8. create a role assignment, the assignee is the client id of the managed identity, the role is AcrPull and the scope is the id of the container registry
    9. create a container apps environment
    10. create a container app with the registry-identity (id from the managed identity), the registry-server (your-registry-name.azurecr.io), the image (your-registry-name.azurecr.io/your-image-name:latest) and the port (80)

bonus tasks: testing, tbd...

  1. ask github copilot to write a (or a few) tests for your api

Additional reading

Official resources

Other resources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 47.8%
  • Python 36.2%
  • Dockerfile 16.0%