Skip to content

Conversation

ukashazia
Copy link

What kind of change does this PR introduce?

  • use cache layers and multiple build stages to reduce image size by half (from ~8Gib to ~4Gib)
  • reduce image build time of successive builds
  • replace Dockerfile.dev with Dockerfile in relevant files

Why was this change needed?

  • building container image takes a while and any change in source code invalidated the node dependency caches
  • image took more than 8 Gib on disk

Checklist:

Put a "X" in the boxes below to indicate you have followed the checklist;

  • [X ] I have read the CONTRIBUTING guide.
  • [ X] I checked that there were not similar issues or PRs already open for this.
  • [X ] This PR fixes just ONE issue (do not include multiple issues or types of change in the same PR) For example, don't try and fix a UI issue and include new dependencies in the same PR.

- use cache layers and multiple build stages to reduce image size (~ 4Gib)
- replace Dockerfile.dev with Dockerfile in relevant files
Copy link

vercel bot commented Sep 3, 2025

@ukashazia is attempting to deploy a commit to the Listinai Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR optimizes the Docker build process for production by implementing multi-stage builds and build caching to reduce image size from ~8GB to ~4GB and improve build times. The changes replace the previous Dockerfile.dev with an optimized production Dockerfile across all build workflows.

  • Implements multi-stage Docker build with separate stages for dependencies, build, production dependencies, and runtime
  • Adds build caching layers and optimizes package installation to reduce successive build times
  • Updates all CI/CD workflows and build scripts to use the new optimized Dockerfile

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
package.json Moves prisma from devDependencies to dependencies for production builds
Dockerfile New multi-stage production-optimized Dockerfile with caching and cleanup
Jenkinsfile Updates Docker build command to use new Dockerfile
.github/workflows/pr-docker-build.yml Updates PR workflow to use optimized Dockerfile
.github/workflows/build-containers.yml Updates container build workflow to use new Dockerfile
.dockerignore Comprehensive ignore rules to reduce build context size
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported


WORKDIR /app

COPY . .
Copy link
Preview

Copilot AI Sep 3, 2025

Choose a reason for hiding this comment

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

Copying the entire source code (COPY . .) before installing production dependencies defeats the purpose of layer caching. Consider copying only package files first, then installing dependencies, then copying source code.

Suggested change
COPY . .
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY apps/*/package.json ./apps/
COPY libraries/*/package.json ./libraries/

Copilot uses AI. Check for mistakes.

@egelhaus
Copy link
Collaborator

egelhaus commented Sep 3, 2025

@sentry review

Copy link

seer-by-sentry bot commented Sep 3, 2025

🔒 GenAI Consent Required

To enable PR review and test generation via Prevent, an organization admin needs to:

  1. Go to your Sentry organization settings
  2. Enable GenAI features for your organization
  3. Enable the PR Review and Test Generation toggle

Once enabled, you can re-trigger this review by commenting.

remove redundant cleanup commands

Co-authored-by: Copilot <[email protected]>
@nevo-david
Copy link
Contributor

Please elaborate on the changes, also we can't change Dockerfile.dev to Dockerfile

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