Skip to content

Fix/docker build issues#707

Closed
omsherikar wants to merge 4 commits into
alphaonelabs:mainfrom
omsherikar:fix/docker-build-issues
Closed

Fix/docker build issues#707
omsherikar wants to merge 4 commits into
alphaonelabs:mainfrom
omsherikar:fix/docker-build-issues

Conversation

@omsherikar
Copy link
Copy Markdown
Contributor

@omsherikar omsherikar commented Oct 10, 2025

  • Add missing system dependencies (pkg-config, default-libmysqlclient-dev, build-essential) for MySQL client compilation
  • Fix Poetry package configuration by removing problematic package inclusion
  • Reorder superuser creation to occur after test data creation to prevent user clearing
  • Set superuser password properly during Docker build process

Resolves MySQL client build failures and Poetry package installation errors

Related issues

Fixes #706

Checklist

  • Did you run the pre-commit? (If not, your PR will most likely not pass — please ensure it passes pre-commit)
  • Did you test the change? (Ensure you didn't just prompt the AI and blindly commit — test the code and confirm it works)
  • [/ ] Added screenshots to the PR description (if applicable)

Summary by CodeRabbit

  • Chores
    • Updated container build to include additional system dependencies for smoother setup.
    • Hardened package installation during image build for more reproducible builds.
    • Adjusted admin account setup so the password is applied after creation and persists after loading sample data.
    • Made package configuration more explicit to ensure correct source discovery.
  • Notes
    • No user-facing functionality changes; improvements target build and deployment reliability.

- Add missing system dependencies (pkg-config, default-libmysqlclient-dev, build-essential) for MySQL client compilation
- Fix Poetry package configuration by removing problematic package inclusion
- Reorder superuser creation to occur after test data creation to prevent user clearing
- Set superuser password properly during Docker build process

Resolves MySQL client build failures and Poetry package installation errors
- Replace hardcoded 'adminpassword' with os.environ['DJANGO_SUPERUSER_PASSWORD']
- Add import os to access environment variables
- Ensures password consistency with build ARG/ENV pattern
- Improves security and flexibility of Docker build process
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 10, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds system packages to the Docker image, tightens Poetry install, and changes Django superuser creation to use an ARG/ENV and set the password post-creation. Also makes pyproject.toml package include explicit source (from = ".").

Changes

Cohort / File(s) Summary
Docker build and setup
Dockerfile
Add pkg-config, default-libmysqlclient-dev, build-essential; run poetry install --no-root; change superuser password flow from hard-coded ENV to ARG propagated to ENV; create superuser then set its password via a manage.py shell command after test data load.
Packaging configuration
pyproject.toml
Change packages entry from { include = "web" } to { include = "web", from = "." }, making package source explicit; adjust surrounding comments accordingly.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Builder as Docker build
    participant Apt as apt-get
    participant Poetry as Poetry installer
    participant Manage as Django manage.py

    Builder->>Apt: install pkg-config, libmysqlclient-dev, build-essential
    Builder->>Poetry: poetry install --no-root
    note right of Poetry #D6EAF8: pyproject packages include from="."
    Builder->>Manage: run createsuperuser (no password)
    Builder->>Manage: run manage.py shell -> set admin password from ENV
    note right of Manage #E8F8F5: Password set after test data load
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly captures the primary focus of the pull request, which is to fix Docker build failures, and is directly related to the changes made. Although it uses a slash, it remains clear and concise in summarizing the main objective.
Linked Issues Check ✅ Passed The changes add the required system dependencies to the Dockerfile, update Poetry package configuration, and adjust the Django superuser creation flow in line with the reproduction steps and expected behavior described in issue #706, resolving all reported build errors.
Out of Scope Changes Check ✅ Passed All modifications in the Dockerfile and pyproject.toml directly address the build failures outlined in issue #706 without introducing unrelated alterations, so no out-of-scope changes are present.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c27a258 and f4e4a78.

📒 Files selected for processing (1)
  • Dockerfile (3 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @omsherikar, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses critical Docker build failures by resolving issues related to MySQL client compilation and Poetry package management. It also improves the reliability of superuser creation within the Docker environment, ensuring that the admin user is correctly set up and its password is properly configured without being overwritten.

Highlights

  • Dependency Management: Added essential system dependencies (pkg-config, default-libmysqlclient-dev, build-essential) to the Dockerfile to ensure successful compilation of the MySQL client.
  • Poetry Configuration: Corrected the Poetry package configuration in pyproject.toml by commenting out a problematic packages inclusion and adjusted the poetry install command in the Dockerfile with --no-root.
  • Superuser Creation: Reordered the superuser creation process in the Dockerfile to occur after test data creation, preventing the superuser from being cleared, and implemented a more robust method for setting the superuser password using ARG and a Django shell command.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively addresses several Docker build issues, including missing system dependencies, Poetry configuration problems, and the superuser creation process. The changes are logical and well-justified. My review includes a critical security recommendation to prevent leaking the superuser password into the Docker image and a suggestion for improving the Dockerfile structure to create a smaller, more secure final image.

Comment thread Dockerfile Outdated
Comment thread Dockerfile
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between de3ebaf and c27a258.

📒 Files selected for processing (2)
  • Dockerfile (3 hunks)
  • pyproject.toml (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.toml

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

TOML files must be valid (check-toml)

Files:

  • pyproject.toml
🔇 Additional comments (1)
pyproject.toml (1)

6-8: Poetry auto-discovery works here

Commenting out the packages override lets Poetry fall back to its default discovery, which avoids the /app/web does not contain any element build error while still packaging the project correctly. Thanks for aligning this with the Docker fix.

Comment thread Dockerfile Outdated
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

🚨 Missing Open Issue Link

This pull request does not reference any open GitHub issue via the Development section.

PRs must be linked to an open issue using GitHub’s "Development" section (on the right sidebar).

How to fix this:

  • Go to the PR page.
  • Use the "Link issue" option in the Development section.
  • Select an appropriate open issue.

This PR will be automatically closed. You can reopen it after linking an open issue.

Thank you!

@github-actions github-actions Bot closed this Oct 14, 2025
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.

[SETUP] Docker build fails with multiple errors preventing project setup

1 participant