move-coop / parsons

A python library of connectors for the progressive community.
https://www.parsonsproject.org/
Other
258 stars 128 forks source link

[Feature] Standardize Docker image build #862

Open gcollazo opened 1 year ago

gcollazo commented 1 year ago

Build and tag Docker images in a predictable way to facilite their usage.

Detailed Description

Context

Currently the Docker image is built from main and tagged latest. This makes the image very unpredictable because it can change at any time.

This has produced issues in the past where a consumer of the Docker image had issues when a bad PR got merged. The image build was triggered and the latest image was replaced without a Parsons release.

Possible Implementation

Option 1: Keep the current Docker image system using Docker Hub. From my investigation I believe we won't be able to easily implement the "short git commit hash". This option is not available on Docker Hub

Based on what I've learned about Docker hub build this is the required setup to implement the tags we want with the exception of the short git commit hash tag.

Source Type Source Docker Tag Dockerfile Context Build Cache Example
Branch main prerelease Dockerfile / TRUE TRUE prerelease
Tag /^[0-9.]+$/ latest Dockerfile / TRUE TRUE latest
Tag /^[0-9.]+$/ {sourceref} Dockerfile / TRUE TRUE 1.2.3

Option 2: Build and tag the image in the CI/CD pipeline. This is my preferred option because it will enable us to set all the tags we want.

Priority

I think this is a low priority feature because as far as I know there is only one consumer of the Docker image. One could argue that making the images more predictable might incentivize more people to use it but that's speculation.

Open Questions

Currently it looks like the project is using CicleCI for CI/CD but I recently say an issue that looks like the project is also using GitHub actions.

Should this be implemented in the existing Circle CI pipeline or on top of GitHub actions?

gcollazo commented 1 year ago

We should wait for #858 to be merged before tackling this.