Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Improved Dockerfiles and pre-built Docker images #3179

Open
dlhck opened this issue Nov 2, 2024 · 2 comments
Open

Improved Dockerfiles and pre-built Docker images #3179

dlhck opened this issue Nov 2, 2024 · 2 comments
Assignees
Labels
dx 💙 Quality of life improvements for developers type: chore 🧤 Not related to production code (build tasks, dependencies etc)
Milestone

Comments

@dlhck
Copy link
Collaborator

dlhck commented Nov 2, 2024

Description:

  • Enhance the existing Dockerfiles and Docker Compose files to optimize the experience of hosting Vendure in production and simplify local development.
  • Publish pre-built Docker images to streamline the setup process, reducing the time and complexity required for developers to get started and easing deployment for production environments.

Motivation:

  • Hosting Vendure in production requires optimized and well-structured Docker configurations to ensure reliability and performance. The current Dockerfiles and Docker Compose files can be improved to better support production use cases.
  • Pre-built Docker images will enable developers to quickly spin up Vendure for local development without having to build the images manually. This will improve the developer experience and accelerate project setup, as well as simplify updates and maintenance in production environments.

Proposed Solution:

  • Refactor the existing Dockerfiles to ensure they follow best practices for production-grade deployments, including optimizations for performance, security, and minimal image size.
  • Update Docker Compose files to include improved configurations that are more suitable for development and production environments.
  • Publish official pre-built Docker images on Docker Hub (or another registry) to allow developers to pull and run Vendure images without building from scratch.
  • Document the updated Docker setup and provide guidelines for using pre-built images in different environments, including recommendations for production deployments.

Additional Context:

  • This feature aims to simplify and accelerate both local development and production deployment of Vendure by providing an improved, out-of-the-box Docker experience. The goal is to make Vendure more accessible for developers and easier to deploy in scalable environments.
@dlhck dlhck added type: feature ✨ dx 💙 Quality of life improvements for developers labels Nov 2, 2024
@dlhck dlhck added this to the v3.1.0 milestone Nov 2, 2024
@dlhck dlhck self-assigned this Nov 2, 2024
@dlhck dlhck moved this to 📅 Planned in Vendure OS Roadmap Nov 2, 2024
@ArseniyX
Copy link

ArseniyX commented Nov 7, 2024

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
Copy link

petercn commented Nov 7, 2024

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 :-)

@dlhck dlhck added type: chore 🧤 Not related to production code (build tasks, dependencies etc) and removed type: feature ✨ labels Nov 9, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
dx 💙 Quality of life improvements for developers type: chore 🧤 Not related to production code (build tasks, dependencies etc)
Projects
Status: 📅 Planned
Development

No branches or pull requests

3 participants