kamsar / Dianoga

An automatic image optimizer for the Sitecore media library.
Other
102 stars 45 forks source link

Docker: Integration tests + Dianoga Docker Assets Images #109

Closed Antonytm closed 2 years ago

Antonytm commented 2 years ago

This PR includes:

  1. Automation to prepare Dianoga Docker Image Assets with different configurations. (different .Net versions) https://hub.docker.com/repository/docker/antonytm/dianoga-assets Currently, they are pushed to my Docker Hub account, but once this automation will be applied to the main one, I am happy to remove it. All that will be required: adding DOCKERHUB_TOKEN and DOCKERHUB_USERNAME as secrets to GitHub Actions.

(It is always a headache to install modules to containers because it will require preparing new images. And that is not only about Dianoga that is about all modules. That is why I think it will be nice to have assets images for Dianoga that could be easily added to containers in exact same way as for SPE, SXA, Horizon, etc.)

  1. Integration tests based on Docker Images After applying "NextGen" format changes, I wonder how many different configurations should be tested.(Sync, Async, enabled SVG, enabled WebP, enabled CDN, ...) That is why I did automation to cover some configurations that different Sitecore sites have now(and will have in the nearest future). a) Async default config b) Sync default config c) +SVG enabled d) +SVG +WEBP enabled e) +SVG +WEBP +AVIF +JXL enabled

Also, all these docker-compose configurations could be used for testing and development. It is much easier to run docker-compose up and start doing some feature or fix for Dianoga rather than preparing the environment first.

Please let me know if you are interested in having all this stuff (or part of this stuff). If yes, I will add more documentation about it.

P.S. There are things that should be improved and I planned to do. But due to the situation in Ukraine, I will not have time to do these things in the nearest future. But also having all these things and forgetting about them is not the right way as a lot of things were done.

P.S.2. You can merge these changes not to the main branch and firstly try them.

markgibbons25 commented 2 years ago

I don't actually use docker myself, but this does look great.

monkey-ldb commented 2 years ago

hi @markgibbons25 , @Antonytm is there now somewhere an official image on a public registry for the dianoga assets? I was only able to find this: https://hub.docker.com/r/antonytm/dianoga-assets/tags is this for production or only test usage?

Antonytm commented 2 years ago

@monkey-ldb

It is not an official one: https://hub.docker.com/r/antonytm/dianoga-assets/tags

It is actually built from my fork: https://github.com/antonytm/dianoga, using GitHub actions: E.g. https://github.com/Antonytm/Dianoga/actions/workflows/Dianoga-Docker-NET48-Release.yml

However, I know at least 2 projects, where that image was used in production. And I am not involved in any of these projects.

The building of this image is completely transparent: everything happens on Github actions. You may review them.

If you have any doubts, you always are able to build your own image: 1) Form the repo 2) Create Docker Hub account 3) Set DOCKERHUB_TOKEN and DOCKERHUB_USERNAME secrets 4) Run actions

I described whole process in detail here: https://exdst.com/posts/20220728-sitecore-docker-github-actions

Antonytm commented 2 years ago

Moving forward: I don't want to "steal" Dianoga and host official Docker images under my account "antonytm" on Docker Hub. It will be fairer to either host it under "kamsar" account or create a new Dianoga-specific Docker Hub account.

In order to build an "official" image, we need: 1) Create a Docker Hub account (free of charge for open source). 2) Add DOCKERHUB_TOKEN and DOCKERHUB_USERNAME secrets to kamsar/dianoga repository. (I don't have access to do it. The settings tab is unavailable for me.) 3) Run Github actions that build images

I will rely on @markgibbons25 opinion on these questions: 1) Do we need an official Dianoga Docker Image asset image? 2) What account should we use for hosting this image?