rog-golang-buddies / golang-template-repository

Kickstarter repository for a golang service
Apache License 2.0
17 stars 7 forks source link

Add support for upload application docker image to dockerhub #18

Open adityaprakash-bobby opened 2 years ago

adityaprakash-bobby commented 2 years ago

It is good to have a workflow which publishes our application bundles into a docker image in dockerhub. On every successful release we can have the image pushed to public repository.

Refs:

pallasite99 commented 2 years ago

Just some further info, this would involve:

  1. Manually testing a Dockerfile located at root repo
  2. Adding CI workflow for this Dockerfile in main
shukra-in-spirit commented 2 years ago

Just some further info, this would involve:

  1. Manually testing a Dockerfile located at root repo
  2. Adding CI workflow for this Dockerfile in main

Further breaking down the first point made by Pallasite:

  1. Testing:
pallasite99 commented 2 years ago

@shukra-in-spirit I think it would also be a good idea to include support for multiple platforms here using qemu so that we are agnostic when it comes to building the docker image now or in the future.

Now, for the purpose of uploading image to Dockerhub ... it would be great if you can create an org account and have the settings to login protected by secrets similar to Sonar cloud setup. I believe that would be required before anyone starts working on this.

Till now, I've tested whether the base docker workflow works here with the current Dockerfile we have.

pallasite99 commented 2 years ago

For the container scanning part, this would roughly be the steps -

  1. Login to Dockerhub
  2. Configure Go
  3. Build the image
  4. Scan the image

ex:

- name: Scan image
      uses: Azure/container-scan@v0
      with:
        image-name: ${{ secrets.ACR_LOGIN_SERVER }}/spring-petclinic:${{ github.run_number }}
        severity-threshold: CRITICAL
        run-quality-checks: true
shukra-in-spirit commented 2 years ago

I had created a docker organisation for us a while back. I will need to find out where it is. Will share.