Skip to content

fix(docker): correct build errors, dead code and missing config#28

Closed
luiscruzcwb wants to merge 1 commit into
evolution-foundation:mainfrom
luiscruzcwb:fix/docker-setup
Closed

fix(docker): correct build errors, dead code and missing config#28
luiscruzcwb wants to merge 1 commit into
evolution-foundation:mainfrom
luiscruzcwb:fix/docker-setup

Conversation

@luiscruzcwb

@luiscruzcwb luiscruzcwb commented Jun 2, 2026

Copy link
Copy Markdown

Summary

  • Dockerfile: remove COPY of postcss.config.js and tailwind.config.js — Tailwind v4 uses the @tailwindcss/vite plugin, these files don't exist and break docker build
  • Dead code: remove .docker/nginx/ directory (9 files) — never copied into the image, referenced dockerize which is not installed
  • add-env-vars.sh: fix env prefix REACT_APP_VITE_ (this is a Vite project); remove _writeNginxEnvVars which depended on the missing dockerize binary
  • docker-compose.yml: drop deprecated version: field, remove NODE_ENV=production (irrelevant in the nginx:alpine final stage), add healthcheck using the existing /health endpoint
  • docker_build.sh: fix registry atendai/evolutionfoundation/, add buildx multi-platform (linux/amd64,linux/arm64), guard missing VERSION argument with set -e
  • .dockerignore: add to exclude node_modules/, .git/ and build artifacts from Docker build context — reduces build context size significantly

Test plan

  • docker build . completes without errors
  • docker compose up starts the container with healthy status
  • docker_build.sh <version> pushes to evolutionfoundation/ registry for both platforms

Summary by Sourcery

Fix Docker build and compose configuration for the Vite-based frontend and clean up unused Docker-related assets.

Bug Fixes:

  • Correct environment variable prefix in add-env-vars script to use VITE_ for injecting frontend env vars.
  • Remove references to non-existent Tailwind/PostCSS config files from the Docker build to prevent build failures.
  • Drop unused nginx env templating that depended on the missing dockerize binary.

Enhancements:

  • Update docker_build script to use the evolutionfoundation registry, add multi-platform buildx support, and tag images with version and latest.
  • Simplify docker-compose service configuration by removing deprecated and unnecessary settings and adding a container healthcheck.
  • Add a .dockerignore file to significantly reduce Docker build context size by excluding dependencies, VCS data, and build artifacts.
  • Remove obsolete nginx configuration directory that was never used in the current Docker image.

- Dockerfile: remove COPY of postcss.config.js and tailwind.config.js
  (Tailwind v4 uses @tailwindcss/vite plugin, no config files needed)
- Remove dead .docker/nginx/ directory (9 files never copied into the
  image, relied on dockerize which is not installed)
- add-env-vars.sh: fix env prefix REACT_APP_ -> VITE_ (Vite project);
  remove _writeNginxEnvVars which depended on missing dockerize binary
- docker-compose.yml: drop deprecated version field, remove
  NODE_ENV=production (irrelevant in nginx:alpine stage), add
  healthcheck using existing /health endpoint
- docker_build.sh: fix registry atendai/ -> evolutionfoundation/,
  add buildx multi-platform (linux/amd64,linux/arm64), set -e and
  require VERSION argument to prevent accidental untagged pushes
- .dockerignore: add to exclude node_modules/, .git/ and build
  artifacts from Docker build context
@sourcery-ai

sourcery-ai Bot commented Jun 2, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates Docker-related tooling and configuration to align with a Vite/Tailwind v4 frontend, fix broken builds, remove unused nginx/dead code, and improve image build/publish behavior and compose health checks.

Sequence diagram for new docker-compose healthcheck using /health endpoint

sequenceDiagram
  participant Docker
  participant Container
  participant App

  Docker->>Container: healthcheck CMD wget -q --spider http://localhost/health
  Container->>App: GET /health
  App-->>Container: 200 OK
  Container-->>Docker: health status healthy
Loading

Flow diagram for updated docker_build.sh multi-platform image build and push

flowchart TD
  A[docker_build.sh] --> B[set -e]
  B --> C{VERSION arg provided?}
  C -- no --> D[exit with usage]
  C -- yes --> E[set IMAGE=evolutionfoundation/evolution-manager-v2]
  E --> F[docker buildx build --platform linux/amd64,linux/arm64]
  F --> G[--tag IMAGE:VERSION]
  G --> H[--tag IMAGE:latest]
  H --> I[--push]
  I --> J[image pushed to registry]
Loading

File-Level Changes

Change Details Files
Align environment-variable injection script with Vite and remove unused nginx-related helpers.
  • Change frontend env var prefix filter from REACT_APP_ to VITE_ when generating ENV JSON for index.html.
  • Remove _writeNginxEnvVars function that depended on the missing dockerize binary.
  • Remove unused SSL helper function and its calls, leaving only the frontend env injection call.
.docker/add-env-vars.sh
Improve Docker image build script to support multi-arch builds and use the correct registry and tagging scheme.
  • Enable strict error handling with set -e and require VERSION argument via parameter expansion.
  • Switch image registry/name from atendai/evolution-manager-v2 to evolutionfoundation/evolution-manager-v2.
  • Use docker buildx build with linux/amd64 and linux/arm64 platforms, tagging both versioned and latest images and pushing directly from the build.
docker_build.sh
Modernize docker-compose configuration and add container health checking.
  • Remove deprecated top-level version field from compose file.
  • Drop NODE_ENV=production environment setting from the nginx-based container as it is unused.
  • Add a healthcheck that polls the existing /health endpoint via wget with configured interval, timeout, and retries.
docker-compose.yml
Fix Dockerfile to match current Vite/Tailwind v4 setup and avoid copying non-existent configuration files.
  • Stop copying postcss.config.js and tailwind.config.js into the build context since Tailwind v4 uses @tailwindcss/vite and these files are absent.
Dockerfile
Reduce Docker build context size by ignoring unnecessary files.
  • Introduce a .dockerignore file that excludes node_modules/, .git/, and build artifacts from the Docker context.
.dockerignore
Remove unused nginx configuration assets that are no longer part of the image build.
  • Delete nginx default.conf, include.d configs (cache, nocache, letsencrypt, spa, ssl, ssl-redirect), and sites.d backend/frontend configs under .docker/nginx since they are never copied into the image and referenced a non-installed dockerize binary.
.docker/nginx/conf.d/default.conf
.docker/nginx/include.d/allcache.conf
.docker/nginx/include.d/letsencrypt.conf
.docker/nginx/include.d/nocache.conf
.docker/nginx/include.d/spa.conf
.docker/nginx/include.d/ssl-redirect.conf
.docker/nginx/include.d/ssl.conf
.docker/nginx/sites.d/backend.conf
.docker/nginx/sites.d/frontend.conf

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@luiscruzcwb luiscruzcwb closed this by deleting the head repository Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant