vendure-ecommerce / vendure

The commerce platform with customization in its DNA.
https://www.vendure.io
Other
5.78k stars 1.03k forks source link

Improved Dockerfiles and pre-built Docker images #3179

Open dlhck opened 2 weeks ago

dlhck commented 2 weeks ago

Description:

Motivation:

Proposed Solution:

Additional Context:

ArseniyX commented 1 week ago

Some suggestions:

  1. To add CD step to build and push new image every commit to tag branch in order to make the image up to date
  2. It could be looks like docker run my-vendure -h localhost -u vendure -p password vendure@latest - and other variables so it very quick start for users who have docker and some db running
  3. ideally to have 2 docker compose 1 for dev 1 for prod (which rarely used).
  4. For dev could be nice to use watch mode and volumes so the changes appear immediately in the container from local machine
petercn commented 1 week ago

This is a big topic but I'd start by taking into account the best practices from the official docs: https://docs.docker.com/build/building/best-practices/

Also, consider the rules in the official "Build checks": https://docs.docker.com/reference/build-checks/ as well as rules in popular dockerfile linters like hadolint: https://github.com/hadolint/hadolint

On suggestion 3 above: It's been popular in the past to make separate compose files like "dev" and "prod", however the latest guidance recommends utilizing "compose.override.yaml" and merging compose files to achieve the same effect with the native mechanism while making the code more DRY too as described here: https://docs.docker.com/compose/how-tos/multiple-compose-files/merge/

On suggestion 4 above: I totally agree that the rather new Compose Watch is great to leverage as described here: https://docs.docker.com/compose/how-tos/file-watch/

Cool new stuff is added to the dockerfile reference all the time so be sure to watch new release notes here over time: https://docs.docker.com/build/buildkit/dockerfile-release-notes/

I could probably write a book on all this but there's my top feedback to get started with and I'll continue to monitor this issue and chime in. Thank you everyone for your hard work :-)