Skip to content

Update Dockerfile #1605

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 23, 2025
Merged

Update Dockerfile #1605

merged 2 commits into from
Jun 23, 2025

Conversation

ToniShelby
Copy link
Contributor

@ToniShelby ToniShelby commented Jun 17, 2025

Summary by Sourcery

Revise Dockerfile to improve build reproducibility, environment management, and image size

Enhancements:

  • Install dos2unix and normalize Docker scripts line endings
  • Introduce default build environment variables and dynamically generate .env for the builder
  • Switch to npm ci and a dedicated build:docker script, then prune devDependencies to slim the image
  • Reorder and consolidate config and source copying for better cache utilization
  • Update final stage to set DOCKER_ENV, create an empty .env, and remove the prebuilt .env copy

Build:

  • Copy tsup.config.ts earlier and adjust file copy patterns
  • Replace npm install with npm ci --silent
  • Invoke custom database generation script with defined env variables
  • Remove devDependencies after build

Copy link
Contributor

sourcery-ai bot commented Jun 17, 2025

Reviewer's Guide

Refactors and enhances the Dockerfile by adding dos2unix support, introducing build and runtime environment variables, optimizing file copy and install steps, integrating Docker scripts (.env generation and database setup), and adjusting final-stage .env and entrypoint handling.

Flow diagram for .env file handling in Docker build and runtime

flowchart LR
    subgraph Build Stage
        A[Generate .env with build-time ENV vars]
        B[Use .env for DB generation and build]
    end
    subgraph Final Stage
        C[Create empty .env file]
        D[Runtime ENV vars provided by Railway or environment]
    end
    A --> B
    C --> D
Loading

File-Level Changes

Change Details Files
Restructure builder stage with environment vars and optimized install/build workflow
  • Added dos2unix to apk packages
  • Defined ENV DOCKER_ENV, DATABASE_PROVIDER, DATABASE_URL
  • Reordered COPY of package*.json, tsconfig.json, tsup.config.ts for caching
  • Replaced npm install with npm ci --silent
  • Changed build command to npm run build:docker
  • Pruned devDependencies via npm prune --production
Dockerfile
Integrate Docker scripts and dynamic .env generation in builder
  • Copied Docker/scripts and applied chmod + dos2unix
  • Generated a basic .env file with build env vars
  • Executed generate_database.sh using defined variables
Dockerfile
Adjust final image .env handling and entrypoint
  • Added DOCKER_ENV env var in final stage
  • Replaced COPY of .env from builder with touch .env for Railway
  • Removed existing ENTRYPOINT command
Dockerfile

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

@dpaes
Copy link

dpaes commented Jun 20, 2025

your modifications its already old, have a new version of evolution api 2.3.0, and u cant put postgres by default, because have mysql and postgres option, even the credentials. And another thing, u are creating that thinking only in railway...

@dpaes
Copy link

dpaes commented Jun 20, 2025

@sourcery-ai review

Copy link
Contributor

sourcery-ai bot commented Jun 20, 2025

Hi @dpaes! 👋

Only authors and team members can run @sourcery-ai commands on public repos.

@DavidsonGomes DavidsonGomes changed the base branch from main to develop June 23, 2025 18:33
@DavidsonGomes DavidsonGomes merged commit 4be818a into EvolutionAPI:develop Jun 23, 2025
1 check failed
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.

3 participants