binbashar/public-docker-images

Build | automation improvement

Closed this issue · 0 comments

What?

Improve current Docker hub build / push automation (https://hub.docker.com/repositories) to avoid wrong tags in images.

Why?

  • If you change the code and do not manually change the build setup (each time) at Docker Hub (eg: https://hub.docker.com/repository/docker/binbash/terraform-resources/builds/edit) this error could be repeated
  • That manual step is unfortunately very error prune, to reduce the toil to the minimum we would have to upgrade to a fully automated as code with CircleCI Approach.
  • This could affect several projects that depends on this images.

image

Bug for https://hub.docker.com/repository/docker/binbash/terraform-awscli

$ dk pull binbash/terraform-awscli:0.12.28
0.12.28: Pulling from binbash/terraform-awscli
d6ff36c9ec48: Already exists
c958d65b3090: Already exists
edaf0a6b092f: Already exists
80931cf68816: Already exists
813643441356: Already exists
d2d74a4aa2e6: Already exists
568efbaeb143: Already exists
d88536342d60: Pull complete
f32e60519772: Pull complete
f813dd0edacb: Pull complete
2cd811637c36: Pull complete
631e45e8e525: Pull complete
b1a17b6c901d: Pull complete
18366e178638: Pull complete
44c7d805879f: Pull complete
8b3910623d82: Pull complete
Digest: sha256:8de0ebee8d5d99cdb67b3be12fe53e0f6f63231185f399fa0de5d446f6479d71
Status: Downloaded newer image for binbash/terraform-awscli:0.12.28
docker.io/binbash/terraform-awscli:0.12.28

$ dk run -it --rm --entrypoint sh binbash/terraform-awscli:0.12.28
# terraform --version
Your version of Terraform is out of date! The latest version
is 0.13.1. You can update by downloading from https://www.terraform.io/downloads.html
Terraform v0.13.0
#

How?

We'll follow https://docs.github.com/en/actions/language-and-framework-guides/publishing-docker-images#publishing-images-to-docker-hub

Reference example below

name: Publish Docker image
on:
  release:
    types: [published]
jobs:
  push_to_registry:
    name: Push Docker image to Docker Hub
    runs-on: ubuntu-latest
    steps:
      - name: Check out the repo
        uses: actions/checkout@v2
      - name: Push to Docker Hub
        uses: docker/build-push-action@v1
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}
          repository: my-docker-hub-namespace/my-docker-hub-repository
          tag_with_ref: true

Consideration

We could temporally handle it as it is with strict attention and to be address during 2020 Q4.