"Deploy Your Website Code: A Journey from GitHub to Docker"

"Deploy Your Website Code: A Journey from GitHub to Docker"

  1. create a gthub repsitory called ‘website code’

  2. clone the repository to the local system

  3. Create a token on github

  4. Open powershell and run as administrator

  5. Paste the cloned code.

  6. and then code . (to open with vscode)

    Now we need to download our code

  7. On your browser, go to ‘free css template’ and select a template

BUILD AND PUSH PIPELINE.

  • git status

  • git add .

  • git commit -m ‘website_code’

  • git push

    TO BUILD A DOCKER IMAGE AND PUSH TO DOCKER REPOSITORY

  • Write a docker file:

  • Create a file called ‘Dockerfile’

  • Copy and paste this information on the docker file created on vscode.

    THEN YOU PUSH

  • git status

  • git add .

  • git commit -m ‘added Dockerfile’

  • git push

  • And now the dockerfile has been pushed to git repository.

    • Click on it to see the command used.

PUSH THE CODE TO DOCKER HUB

  • Write the pipeline as a code:

  • Create a folder called ‘.github’ and ‘workflow’ and under the worflow create a file called ‘docker_build_push.yml’

  • On your browser,type ‘github market place’,click on ‘all actions’

  • Select ‘Build and push docker image’

    • Scroll down and see the command,copy and paste on your file created on vscode.

      • Create a variable called DOCKERHUB_USERNAME

      • Go to your repo and create a variable,which the username is ‘DOCKERHUB_USERNAME’ and paste your dockerhub username as the value,e.g tedcloud.

      • Create a docker token,go to your dockerhub account,setting,perosnal access token,and generate a new token. e.g pipeline_token.

        • And generate,then copy the token and paste on the secret value.

        • Go to vscode and type these commands:

        • git status

        • git add .

        • git commit -m ‘Added gitaction pipeline code’

        • git push

    • And now the pipeline has been deployed on gitaction and dockerhub.