Skip to content

Commit 286df0a

Browse files
authored
Merge pull request IvorySQL#982 from rophy/feat/dev-container
feat: dev container
2 parents 892d5e8 + 1bbdadc commit 286df0a

File tree

4 files changed

+130
-0
lines changed

4 files changed

+130
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# IvorySQL Build and Test Container - Modern Ubuntu
2+
# Alternative to CentOS with same capabilities
3+
4+
FROM ubuntu:22.04
5+
6+
# Prevent interactive prompts
7+
ENV DEBIAN_FRONTEND=noninteractive
8+
9+
# Install build dependencies matching the workflow requirements
10+
RUN apt-get update && apt-get install -y \
11+
# Build tools
12+
build-essential git lcov bison flex pkg-config cppcheck \
13+
# Core dependencies
14+
libkrb5-dev libssl-dev libldap-dev libpam-dev \
15+
libxml2-dev libxslt-dev libreadline-dev libedit-dev \
16+
zlib1g-dev uuid-dev libossp-uuid-dev libuuid1 e2fsprogs \
17+
# ICU support
18+
libicu-dev \
19+
# Language support
20+
python3-dev tcl-dev libperl-dev gettext \
21+
# Perl test modules
22+
libipc-run-perl libtime-hires-perl libtest-simple-perl \
23+
# LLVM/Clang
24+
llvm clang \
25+
# LZ4 compression
26+
liblz4-dev \
27+
# System libraries
28+
libselinux1-dev libsystemd-dev \
29+
# GSSAPI
30+
libgssapi-krb5-2 \
31+
# Locale support
32+
locales \
33+
# For dev containers
34+
sudo tini \
35+
&& rm -rf /var/lib/apt/lists/*
36+
37+
# Set up locale
38+
RUN locale-gen en_US.UTF-8
39+
ENV LANG=en_US.UTF-8 \
40+
LANGUAGE=en_US:en \
41+
LC_ALL=en_US.UTF-8
42+
43+
# Create ivorysql user with matching host UID/GID (1000:1000)
44+
# and grant sudo privileges without password
45+
ARG USER_UID=1000
46+
ARG USER_GID=1000
47+
RUN groupadd -g ${USER_GID} ivorysql || true && \
48+
useradd -m -u ${USER_UID} -g ${USER_GID} -d /home/ivorysql -s /bin/bash ivorysql && \
49+
echo "ivorysql ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
50+
51+
# Set working directory
52+
WORKDIR /home/ivorysql/IvorySQL
53+
54+
# Switch to ivorysql user for builds
55+
USER ivorysql
56+
57+
# Default command
58+
ENTRYPOINT ["/usr/bin/tini", "--"]
59+
CMD ["/bin/bash"]

.devcontainer/devcontainer.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "IvorySQL Dev",
3+
"dockerComposeFile": "../docker-compose.yaml",
4+
"service": "dev",
5+
"workspaceFolder": "/home/ivorysql/IvorySQL",
6+
"remoteUser": "ivorysql",
7+
"customizations": {
8+
"vscode": {
9+
"settings": {
10+
"terminal.integrated.defaultProfile.linux": "bash",
11+
"C_Cpp.default.configurationProvider": "ms-vscode.makefile-tools"
12+
},
13+
"extensions": [
14+
"ms-vscode.cpptools",
15+
"ms-vscode.makefile-tools",
16+
"twxs.cmake",
17+
"mhutchie.git-graph",
18+
"eamodio.gitlens"
19+
]
20+
}
21+
}
22+
}

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,37 @@ Furthermore, for more detailed installation instructions, please refer to the [I
3131
- [Rpm installation](https://docs.ivorysql.org/en/ivorysql-doc/v5.0/v5.0/4.1#Rpm-installation)
3232
- [Source code installation](https://docs.ivorysql.org/en/ivorysql-doc/v5.0/v5.0/4.1#Source-code-installation)
3333

34+
## Development with Docker
35+
36+
For a consistent development environment, we provide a Docker-based setup that includes all build dependencies.
37+
38+
### Quick Start
39+
40+
```bash
41+
# Start the development containers
42+
docker compose up -d
43+
44+
# Enter the development container
45+
docker compose exec dev bash
46+
47+
# Configure and build IvorySQL
48+
./configure --prefix=/home/ivorysql/ivorysql \
49+
--enable-debug --enable-cassert \
50+
--with-uuid=e2fs --with-libxml
51+
52+
make -j$(nproc)
53+
make install
54+
55+
# Initialize database in Oracle mode
56+
initdb -D data_ora -m oracle
57+
58+
# Start the server
59+
pg_ctl -D data_ora start
60+
61+
# Run tests
62+
make oracle-check
63+
```
64+
3465
## Developer Formatting hooks and CI:
3566
- A pre-commit formatting hook is provided at `.githooks/pre-commit`. Enable it with `git config core.hooksPath .githooks`, or run `make code-format` (equivalently `bash tools/enable-git-hooks.sh`).
3667
- The hook depends only on in-tree tools `src/tools/pgindent` and `src/tools/pg_bsd_indent`. On commit it formats staged C/C++ files with pgindent and re-adds them to the staged area.

docker-compose.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
services:
2+
dev:
3+
build:
4+
context: .
5+
dockerfile: .devcontainer/Dockerfile
6+
image: ivorysql-dev
7+
container_name: ivorysql-dev
8+
volumes:
9+
- .:/home/ivorysql/IvorySQL:rw
10+
working_dir: /home/ivorysql/IvorySQL
11+
command: ["sleep", "infinity"]
12+
13+
# docker compose --profile ora up -d
14+
oracle:
15+
profiles: [ora]
16+
image: container-registry.oracle.com/database/free:23.26.0.0-lite
17+
environment:
18+
ORACLE_PWD: orapwd

0 commit comments

Comments
 (0)