Skip to content

feat: dev container#982

Merged
gaoxueyu merged 3 commits intoIvorySQL:masterfrom
rophy:feat/dev-container
Dec 18, 2025
Merged

feat: dev container#982
gaoxueyu merged 3 commits intoIvorySQL:masterfrom
rophy:feat/dev-container

Conversation

@rophy
Copy link
Copy Markdown
Contributor

@rophy rophy commented Nov 26, 2025

A docker-compose for building and testing of IvorySQL. Created from .github/workflows/build.yml.

an oracle database free is also included for testing against a real oracle database. Even though the version won't match actual corporate envs, it's good enough for basic function tests.

Summary by CodeRabbit

  • Documentation

    • Added Docker-based development workflow guide with container setup, configuration, and testing instructions
    • Added CI formatting-check documentation
  • Chores

    • Added a containerized development environment with a prebuilt dev container, VS Code integration, and tooling
    • Enabled an Oracle database service for local development and testing

✏️ Tip: You can customize this high-level summary in your review settings.

Include Dockerfile and docker-compose.yaml for consistent development setup
with Ubuntu 22.04 and Oracle Free container for testing.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Nov 26, 2025

Walkthrough

Adds a Docker-based development workflow: a new devcontainer Dockerfile and devcontainer.json, an updated docker-compose enabling an Oracle service, and README instructions for starting the dev container, building IvorySQL, initializing an Oracle-mode DB, and running Oracle-specific tests.

Changes

Cohort / File(s) Summary
Documentation
README.md
Adds "Development with Docker" section with commands to start containers, enter the dev container, configure and build IvorySQL, initialize an Oracle-mode DB, start the server, and run Oracle-specific tests; adds Cirrus FormatCheck (pgindent --check) note to Developer Formatting hooks and CI.
Docker Compose
docker-compose.yaml
Activates a new oracle service (image container-registry.oracle.com/database/free:23.26.0.0-lite, ORACLE_PWD=orapwd, profile ora); retains dev service building from .devcontainer/Dockerfile, mounting workspace and running sleep infinity.
Dev container Dockerfile
.devcontainer/Dockerfile
New Ubuntu 22.04-based build/test container: installs comprehensive build and system dependencies (compilers, libs, ICU, Python, Perl modules, LLVM/Clang, LZ4, locales, tini, sudo), sets locale, creates ivorysql user with configurable UID/GID and passwordless sudo, sets workdir, ENTRYPOINT and default CMD.
VS Code Dev Container Config
.devcontainer/devcontainer.json
New devcontainer config: uses ../docker-compose.yaml target dev, sets workspaceFolder /home/ivorysql/IvorySQL, remoteUser ivorysql, default shell to bash, and recommends/extensions for C/C++, Makefile, CMake, and Git tooling.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–30 minutes

  • Review .devcontainer/Dockerfile for completeness, package versions, and unnecessary privileged operations.
  • Verify docker-compose.yaml Oracle service settings (image tag, env, profiles) and volume/port expectations.
  • Confirm devcontainer.json paths, remoteUser, and extension IDs are correct and compatible with target VS Code setup.
  • Check README commands for accuracy and reproducibility (paths, command order, required prerequisites).

Possibly related PRs

  • Update readme #978 — Adds the Cirrus FormatCheck/pgindent check entry to the README's Developer Formatting hooks and CI section (same formatting CI item).

Poem

🐰
In a crate of code I hop and play,
Containers hum and build all day,
I stitch dependencies neat and tight,
VS Code beams with terminal light,
A tiny hop brings dev delight. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: dev container' is directly related to the main change: adding Docker-based development infrastructure including docker-compose.yaml, Dockerfile, and devcontainer.json configuration files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6e6d4f4 and 1bbdadc.

📒 Files selected for processing (3)
  • .devcontainer/Dockerfile (1 hunks)
  • .devcontainer/devcontainer.json (1 hunks)
  • docker-compose.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • .devcontainer/Dockerfile
  • .devcontainer/devcontainer.json
  • docker-compose.yaml

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.

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

🧹 Nitpick comments (4)
Dockerfile (1)

43-49: Document the passwordless sudo usage and its implications for dev containers.

Granting passwordless sudo to the ivorysql user is acceptable for development containers but should be documented or accompanied by a security note. In production or shared environments, this would be inappropriate.

Recommendation: Add a comment in the Dockerfile explaining that this is intended for development only and should not be replicated in production images. Consider adding this detail to the README's Docker section as well.

Apply this diff to add clarifying comments:

 # Create ivorysql user with matching host UID/GID (1000:1000)
-# and grant sudo privileges without password
+# and grant sudo privileges without password (dev container only)
 ARG USER_UID=1000
 ARG USER_GID=1000
 RUN groupadd -g ${USER_GID} ivorysql || true && \
     useradd -m -u ${USER_UID} -g ${USER_GID} -d /home/ivorysql -s /bin/bash ivorysql && \
+    # WARNING: Passwordless sudo is only suitable for development containers
     echo "ivorysql ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
docker-compose.yaml (2)

1-1: Add compose file version for explicit API contract.

While Docker Compose works without a version field, explicitly specifying the version ensures compatibility and makes the file's API contract clear.

Apply this diff to add the version field:

+version: '3.8'
+
 services:

13-16: Consider using environment variables for Oracle password and consider image freshness.

The hardcoded password and specific Oracle image tag have trade-offs:

  • Password management: Hardcoding orapwd is acceptable for dev containers, but consider using a .env file or environment variable pattern for consistency with other projects and to enable easy customization without editing the compose file.
  • Image versioning: The pinned tag 23.26.0.0-lite ensures reproducibility, but Oracle Container Registry tags may change or become unavailable. Consider documenting the image freshness requirement or using a more stable tag strategy.

Apply this diff to use environment variables:

  oracle:
    image: container-registry.oracle.com/database/free:23.26.0.0-lite
    environment:
-      ORACLE_PWD: orapwd
+      ORACLE_PWD: ${ORACLE_PWD:-orapwd}

Then create a .env file (or document in README) with:

ORACLE_PWD=orapwd
README.md (1)

34-63: Docker development documentation is well-structured and comprehensive.

The new "Development with Docker" section provides clear, step-by-step instructions with practical examples. The workflow covers configuration, building, initialization, startup, and testing—all essential for developers onboarding to the project.

Recommendation: Consider adding a note about system requirements (e.g., minimum Docker version, minimum disk space for Oracle Free Database image which can be ~6-7 GB) in the Quick Start section to prevent user surprises.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c51d958 and b1ca97e.

📒 Files selected for processing (3)
  • Dockerfile (1 hunks)
  • README.md (1 hunks)
  • docker-compose.yaml (1 hunks)
🔇 Additional comments (1)
README.md (1)

68-68: I'll help you verify whether the FormatCheck Cirrus workflow is defined in the CI configuration. Let me search the repository for Cirrus CI configuration files and verify the workflow exists.
<function_calls>


#!/bin/bash

Search for Cirrus CI configuration files

fd -e yml -e yaml | head -20


</function_calls>
<function_calls>


#!/bin/bash

Search for FormatCheck workflow in Cirrus CI configuration files

find . -type f ( -name ".yml" -o -name ".yaml" ) | xargs grep -l "FormatCheck|pgindent" 2>/dev/null


</function_calls>

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

🧹 Nitpick comments (1)
.devcontainer/Dockerfile (1)

47-47: Avoid silently masking errors with || true unless the failure is expected and safe to ignore.

Line 47 uses || true to suppress all groupadd errors, including unexpected ones. This could mask real problems (e.g., permission issues, invalid arguments). If the intent is to idempotently handle existing groups, be explicit about which error to ignore.

-RUN groupadd -g ${USER_GID} ivorysql || true && \
+# Create group if it doesn't exist; ignore "already exists" error
+RUN groupadd -g ${USER_GID} ivorysql 2>/dev/null || true && \

Alternatively, use a more robust pattern:

-RUN groupadd -g ${USER_GID} ivorysql || true && \
+RUN ! getent group ivorysql >/dev/null && groupadd -g ${USER_GID} ivorysql || true && \
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b1ca97e and 6e6d4f4.

📒 Files selected for processing (3)
  • .devcontainer/Dockerfile (1 hunks)
  • .devcontainer/devcontainer.json (1 hunks)
  • docker-compose.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • docker-compose.yaml
🔇 Additional comments (5)
.devcontainer/Dockerfile (3)

10-35: Well-structured dependency installation.

The single-layer RUN statement is efficient and includes proper apt cache cleanup. Grouping related packages with comments aids maintainability.


37-41: Locale setup is appropriate.

The UTF-8 locale configuration is correctly set to match typical development environments.


58-59: Appropriate use of tini as init system.

Using tini as the entry point is a best practice for properly handling signals and reaping zombie processes in containers.

.devcontainer/devcontainer.json (2)

7-20: VS Code customizations are well-chosen for C++ development.

The selected extensions (C++ tools, Makefile tools, CMake, Git utilities) and terminal/compiler settings are appropriate for building and testing IvorySQL. The configuration provider referencing makefile-tools aligns with the Dockerfile's build dependencies.


1-22: I was unable to clone the repository to verify the docker-compose.yaml reference. Without access to the repository files, I cannot definitively confirm or deny whether the docker-compose.yaml file exists at the repository root or whether it contains the required "dev" service configuration.

Verify that docker-compose.yaml exists in the repository root and correctly defines a service named "dev".

The devcontainer.json references ../docker-compose.yaml with service "dev". This file and service definition need to exist and align with the workspace configuration (workspaceFolder: /home/ivorysql/IvorySQL, remoteUser: ivorysql) for the dev container to launch properly. Manual verification of the docker-compose.yaml file is required.

Comment thread .devcontainer/Dockerfile
Comment on lines +43 to +49
# Create ivorysql user with matching host UID/GID (1000:1000)
# and grant sudo privileges without password
ARG USER_UID=1000
ARG USER_GID=1000
RUN groupadd -g ${USER_GID} ivorysql || true && \
useradd -m -u ${USER_UID} -g ${USER_GID} -d /home/ivorysql -s /bin/bash ivorysql && \
echo "ivorysql ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot Nov 27, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Security risk: passwordless sudo for all commands.

Granting the ivorysql user passwordless sudo access to all commands poses a security risk. Even in development containers, this should be restricted or at minimum documented with clear security disclaimers. Consider limiting sudo to specific commands (e.g., apt-get, package management) or requiring authentication for sensitive operations.

If passwordless sudo is intentional, add a comment explaining the security trade-off and the intended use case (e.g., "local dev-only, not for production").

 # Create ivorysql user with matching host UID/GID (1000:1000)
-# and grant sudo privileges without password
+# and grant sudo privileges without password (dev-only, security trade-off for convenience)
 ARG USER_UID=1000
 ARG USER_GID=1000
 RUN groupadd -g ${USER_GID} ivorysql || true && \
     useradd -m -u ${USER_UID} -g ${USER_GID} -d /home/ivorysql -s /bin/bash ivorysql && \
     echo "ivorysql ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Create ivorysql user with matching host UID/GID (1000:1000)
# and grant sudo privileges without password
ARG USER_UID=1000
ARG USER_GID=1000
RUN groupadd -g ${USER_GID} ivorysql || true && \
useradd -m -u ${USER_UID} -g ${USER_GID} -d /home/ivorysql -s /bin/bash ivorysql && \
echo "ivorysql ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
# Create ivorysql user with matching host UID/GID (1000:1000)
# and grant sudo privileges without password (dev-only, security trade-off for convenience)
ARG USER_UID=1000
ARG USER_GID=1000
RUN groupadd -g ${USER_GID} ivorysql || true && \
useradd -m -u ${USER_UID} -g ${USER_GID} -d /home/ivorysql -s /bin/bash ivorysql && \
echo "ivorysql ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
🤖 Prompt for AI Agents
.devcontainer/Dockerfile lines 43-49: the Dockerfile currently adds a sudoers
entry granting passwordless sudo for all commands to the ivorysql user, which is
a security risk; either restrict the sudoers entry to only required commands
(e.g., apt, dpkg, systemctl equivalents used in the dev container) instead of
ALL, or if you intentionally need full passwordless sudo for local development,
leave it but add a clear comment above the RUN explaining the trade-off and that
this is strictly for local-dev containers only (not for production) and document
which workflows require it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The Dockerfile is located at .devcontainer/Dockerfile, which should be obvious this is dev-only.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@rophy, you're absolutely right—the .devcontainer/ directory is a well-established convention that clearly signals this is a development-only container. I appreciate you clarifying that context. I'll note your preference here and won't flag similar patterns in dev container configurations.

🐰✨

@rophy rophy force-pushed the feat/dev-container branch from 6e6d4f4 to 1bbdadc Compare November 30, 2025 05:15
@NotHimmel
Copy link
Copy Markdown
Collaborator

/assign

@rophy
Copy link
Copy Markdown
Contributor Author

rophy commented Dec 12, 2025

@NotHimmel any chance to get this reviewed?

@NotHimmel
Copy link
Copy Markdown
Collaborator

@NotHimmel* any chance to get this reviewed?

Thanks a lot for this! Everything looks good, and we plan to merge this shortly.

@gaoxueyu gaoxueyu merged commit 286df0a into IvorySQL:master Dec 18, 2025
6 checks passed
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