From 946027feca24731ec2efe0bc5345d817cf9f0bab Mon Sep 17 00:00:00 2001 From: tirthpatel90 Date: Sun, 12 Apr 2026 15:50:46 +0530 Subject: [PATCH 01/16] Testing maximal docker build on GH servers --- .github/workflows/test-docker.yml | 26 +++++++++ Dockerfile.maximal | 87 +++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 .github/workflows/test-docker.yml create mode 100644 Dockerfile.maximal diff --git a/.github/workflows/test-docker.yml b/.github/workflows/test-docker.yml new file mode 100644 index 000000000..9da897a7d --- /dev/null +++ b/.github/workflows/test-docker.yml @@ -0,0 +1,26 @@ +name: Test Maximal Docker Build + +on: + push: + branches: + - feature/optimize-docker-ci # Yeh sirf teri branch par chalega + +jobs: + test-build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Free disk space (Zaruri hai warna server full ho jayega) + run: | + df -h + sudo rm -rf /usr/local/lib/android + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + docker system prune -af || true + + - name: Build the Monster Maximal Image + run: | + echo "Building the maximal image. Let's go!" + docker build -t serena-maximal -f Dockerfile.maximal . \ No newline at end of file diff --git a/Dockerfile.maximal b/Dockerfile.maximal new file mode 100644 index 000000000..fa393044f --- /dev/null +++ b/Dockerfile.maximal @@ -0,0 +1,87 @@ +# --------------------------------------------------------- +# STAGE 1: The Maximal Base (All dependencies baked in) +# --------------------------------------------------------- +FROM python:3.11-slim AS base +SHELL ["/bin/bash", "-c"] + +ENV PYTHONUNBUFFERED=1 +ENV PYTHONDONTWRITEBYTECODE=1 + +# 1. Install ALL system dependencies together to save layers +RUN apt-get update && apt-get install -y --no-install-recommends \ + curl build-essential git ssh sudo wget zip unzip \ + sed \ + ccls \ + fpc fpc-source \ + libcurl4-openssl-dev \ + cpanminus libanyevent-perl libio-aio-perl \ + default-jdk \ + ruby-full \ + golang-go \ + && rm -rf /var/lib/apt/lists/* + +# 2. Install pipx +RUN python3 -m pip install --no-cache-dir pipx \ + && pipx ensurepath + +# 3. Install Node.js & Elm (From yaml) +ENV NVM_VERSION=0.40.3 +ENV NODE_VERSION=22.18.0 +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash +ENV NVM_DIR=/root/.nvm +RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION} \ + && nvm use v${NODE_VERSION} \ + && nvm alias default v${NODE_VERSION} \ + && npm install -g elm@0.19.1-6 +ENV PATH="${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}" + +# Add local bin to the path +ENV PATH="${PATH}:/root/.local/bin" + +# 4. Install uv +RUN curl -LsSf https://astral.sh/uv/install.sh | sh + +# 5. Install Rust +ENV RUSTUP_HOME=/usr/local/rustup +ENV CARGO_HOME=/usr/local/cargo +ENV PATH="${CARGO_HOME}/bin:${PATH}" +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \ + --default-toolchain stable \ + --profile minimal \ + && rustup component add rust-analyzer + +# 6. Install Go gopls (From yaml) +RUN go install golang.org/x/tools/gopls@latest +ENV PATH="/root/go/bin:${PATH}" + +# 7. Install Ruby LSP (From yaml) +RUN gem install ruby-lsp + +# 8. Install Perl Language Server (From yaml) +RUN PERL_MM_USE_DEFAULT=1 cpanm --notest --force Perl::LanguageServer + +# --------------------------------------------------------- +# STAGE 2: Serena App Setup +# --------------------------------------------------------- +WORKDIR /workspaces/serena + +# Copy all files for development +COPY . /workspaces/serena/ + +# Create Serena configuration +ENV SERENA_HOME=/workspaces/serena/config +RUN mkdir -p $SERENA_HOME +RUN cp src/serena/resources/serena_config.template.yml $SERENA_HOME/serena_config.yml +RUN sed -i 's/^gui_log_window: .*/gui_log_window: False/' $SERENA_HOME/serena_config.yml +RUN sed -i 's/^web_dashboard_listen_address: .*/web_dashboard_listen_address: 0.0.0.0/' $SERENA_HOME/serena_config.yml +RUN sed -i 's/^web_dashboard_open_on_launch: .*/web_dashboard_open_on_launch: False/' $SERENA_HOME/serena_config.yml + +# Create virtual environment and install dependencies (including ansible from yaml) +RUN uv venv +RUN . .venv/bin/activate \ + && uv pip install -r pyproject.toml -e . \ + && uv pip install ansible-core ansible-lint + +ENV PATH="/workspaces/serena/.venv/bin:${PATH}" + +ENTRYPOINT ["/bin/bash", "-c", "source .venv/bin/activate && $0 $@"] \ No newline at end of file From 0ccb6172be0d45f114b408c24daec420d2e94053 Mon Sep 17 00:00:00 2001 From: tirthpatel90 Date: Mon, 13 Apr 2026 17:46:50 +0530 Subject: [PATCH 02/16] Added Phase 2 languages to maximal image --- Dockerfile.maximal | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/Dockerfile.maximal b/Dockerfile.maximal index fa393044f..4194481f9 100644 --- a/Dockerfile.maximal +++ b/Dockerfile.maximal @@ -60,6 +60,51 @@ RUN gem install ruby-lsp # 8. Install Perl Language Server (From yaml) RUN PERL_MM_USE_DEFAULT=1 cpanm --notest --force Perl::LanguageServer +# --------------------------------------------------------- +# STAGE 1.5: Additional Languages and Tools +# --------------------------------------------------------- + +# Install Terraform +RUN wget https://releases.hashicorp.com/terraform/1.5.0/terraform_1.5.0_linux_amd64.zip \ + && unzip terraform_1.5.0_linux_amd64.zip \ + && mv terraform /usr/local/bin/ \ + && rm terraform_1.5.0_linux_amd64.zip + +# Install R and R Language Server +RUN apt-get update && apt-get install -y r-base \ + && Rscript -e "install.packages('languageserver', repos='https://cloud.r-project.org')" \ + && rm -rf /var/lib/apt/lists/* + +# Install Julia and Julia Language Server +RUN curl -L https://julialang-s3.julialang.org/bin/linux/x64/1.10/julia-1.10.0-linux-x86_64.tar.gz -o julia.tar.gz \ + && tar -xzf julia.tar.gz -C /usr/local --strip-components=1 \ + && rm julia.tar.gz \ + && julia -e 'using Pkg; Pkg.add("LanguageServer")' + +# Install Zig and ZLS (Zig Language Server) +RUN wget https://github.com/zigtools/zls/releases/download/0.14.0/zls-x86_64-linux.tar.xz \ + && tar -xf zls-x86_64-linux.tar.xz \ + && mv zls /usr/local/bin/ \ + && rm zls-x86_64-linux.tar.xz \ + && wget https://ziglang.org/download/0.14.0/zig-linux-x86_64-0.14.0.tar.xz \ + && tar -xf zig-linux-x86_64-0.14.0.tar.xz -C /usr/local --strip-components=1 \ + && rm zig-linux-x86_64-0.14.0.tar.xz + +# Install Lua Language Server +ENV LUA_LS_VERSION="3.15.0" +RUN mkdir -p /opt/lua-ls \ + && wget https://github.com/LuaLS/lua-language-server/releases/download/${LUA_LS_VERSION}/lua-language-server-${LUA_LS_VERSION}-linux-x64.tar.gz \ + && tar -xzf lua-language-server-${LUA_LS_VERSION}-linux-x64.tar.gz -C /opt/lua-ls \ + && rm lua-language-server-${LUA_LS_VERSION}-linux-x64.tar.gz \ + && chmod +x /opt/lua-ls/bin/lua-language-server \ + && ln -s /opt/lua-ls/bin/lua-language-server /usr/local/bin/lua-language-server + +# Install Regal (Rego Language Server) +ENV REGAL_VERSION="0.39.0" +RUN curl -L -o regal https://github.com/StyraInc/regal/releases/download/v${REGAL_VERSION}/regal_Linux_x86_64 \ + && chmod +x regal \ + && mv regal /usr/local/bin/ + # --------------------------------------------------------- # STAGE 2: Serena App Setup # --------------------------------------------------------- From 838d650c7bbe029ab24d30be43c4e455befb7414 Mon Sep 17 00:00:00 2001 From: tirthpatel90 Date: Mon, 13 Apr 2026 18:01:39 +0530 Subject: [PATCH 03/16] Fix Julia installation path in Dockerfile --- Dockerfile.maximal | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile.maximal b/Dockerfile.maximal index 4194481f9..efe50617c 100644 --- a/Dockerfile.maximal +++ b/Dockerfile.maximal @@ -75,10 +75,12 @@ RUN apt-get update && apt-get install -y r-base \ && Rscript -e "install.packages('languageserver', repos='https://cloud.r-project.org')" \ && rm -rf /var/lib/apt/lists/* -# Install Julia and Julia Language Server +# Install Julia and Julia Language Server in an isolated directory RUN curl -L https://julialang-s3.julialang.org/bin/linux/x64/1.10/julia-1.10.0-linux-x86_64.tar.gz -o julia.tar.gz \ - && tar -xzf julia.tar.gz -C /usr/local --strip-components=1 \ + && mkdir -p /opt/julia \ + && tar -xzf julia.tar.gz -C /opt/julia --strip-components=1 \ && rm julia.tar.gz \ + && ln -s /opt/julia/bin/julia /usr/local/bin/julia \ && julia -e 'using Pkg; Pkg.add("LanguageServer")' # Install Zig and ZLS (Zig Language Server) From e7577a9925b3d62c52be0aab38507a03f2659bc6 Mon Sep 17 00:00:00 2001 From: tirthpatel90 Date: Mon, 13 Apr 2026 18:21:28 +0530 Subject: [PATCH 04/16] Fix Julia executable stack security issue using execstack --- Dockerfile.maximal | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Dockerfile.maximal b/Dockerfile.maximal index efe50617c..aaad0d19a 100644 --- a/Dockerfile.maximal +++ b/Dockerfile.maximal @@ -75,13 +75,21 @@ RUN apt-get update && apt-get install -y r-base \ && Rscript -e "install.packages('languageserver', repos='https://cloud.r-project.org')" \ && rm -rf /var/lib/apt/lists/* -# Install Julia and Julia Language Server in an isolated directory -RUN curl -L https://julialang-s3.julialang.org/bin/linux/x64/1.10/julia-1.10.0-linux-x86_64.tar.gz -o julia.tar.gz \ +# --------------------------------------------------------- +# Install execstack, configure Julia, and install Language Server. +# The execstack tool is used to clear the executable stack flag from +# libopenlibm.so to bypass strict Docker security policies. +# --------------------------------------------------------- +RUN apt-get update && apt-get install -y execstack \ + && curl -L https://julialang-s3.julialang.org/bin/linux/x64/1.10/julia-1.10.0-linux-x86_64.tar.gz -o julia.tar.gz \ && mkdir -p /opt/julia \ && tar -xzf julia.tar.gz -C /opt/julia --strip-components=1 \ && rm julia.tar.gz \ + && execstack -c /opt/julia/lib/julia/libopenlibm.so \ && ln -s /opt/julia/bin/julia /usr/local/bin/julia \ - && julia -e 'using Pkg; Pkg.add("LanguageServer")' + && julia -e 'using Pkg; Pkg.add("LanguageServer")' \ + && apt-get remove -y execstack \ + && rm -rf /var/lib/apt/lists/* # Install Zig and ZLS (Zig Language Server) RUN wget https://github.com/zigtools/zls/releases/download/0.14.0/zls-x86_64-linux.tar.xz \ From 9d3699bda49b0608f30ad82f236d984617f4f58a Mon Sep 17 00:00:00 2001 From: tirthpatel90 Date: Mon, 13 Apr 2026 18:45:58 +0530 Subject: [PATCH 05/16] Bump Julia version to 1.10.4 to resolve openlibm executable stack bug --- Dockerfile.maximal | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Dockerfile.maximal b/Dockerfile.maximal index aaad0d19a..ffae6a750 100644 --- a/Dockerfile.maximal +++ b/Dockerfile.maximal @@ -76,20 +76,17 @@ RUN apt-get update && apt-get install -y r-base \ && rm -rf /var/lib/apt/lists/* # --------------------------------------------------------- -# Install execstack, configure Julia, and install Language Server. -# The execstack tool is used to clear the executable stack flag from -# libopenlibm.so to bypass strict Docker security policies. # --------------------------------------------------------- -RUN apt-get update && apt-get install -y execstack \ - && curl -L https://julialang-s3.julialang.org/bin/linux/x64/1.10/julia-1.10.0-linux-x86_64.tar.gz -o julia.tar.gz \ +# Install Julia and Julia Language Server. +# Upgraded to version 1.10.4 to natively bypass the known +# executable stack bug present in the 1.10.0 release. +# --------------------------------------------------------- +RUN curl -L https://julialang-s3.julialang.org/bin/linux/x64/1.10/julia-1.10.4-linux-x86_64.tar.gz -o julia.tar.gz \ && mkdir -p /opt/julia \ && tar -xzf julia.tar.gz -C /opt/julia --strip-components=1 \ && rm julia.tar.gz \ - && execstack -c /opt/julia/lib/julia/libopenlibm.so \ && ln -s /opt/julia/bin/julia /usr/local/bin/julia \ - && julia -e 'using Pkg; Pkg.add("LanguageServer")' \ - && apt-get remove -y execstack \ - && rm -rf /var/lib/apt/lists/* + && julia -e 'using Pkg; Pkg.add("LanguageServer")' # Install Zig and ZLS (Zig Language Server) RUN wget https://github.com/zigtools/zls/releases/download/0.14.0/zls-x86_64-linux.tar.xz \ From 2c06bc94e0c3a5fa1e8eea8d9d3298034f5eea74 Mon Sep 17 00:00:00 2001 From: tirthpatel90 Date: Mon, 13 Apr 2026 18:59:35 +0530 Subject: [PATCH 06/16] Complete unified Dockerfile.maximal with multi-stage Julia and R headers --- Dockerfile.maximal | 73 ++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 41 deletions(-) diff --git a/Dockerfile.maximal b/Dockerfile.maximal index ffae6a750..c7d8b1b66 100644 --- a/Dockerfile.maximal +++ b/Dockerfile.maximal @@ -1,3 +1,8 @@ +# --------------------------------------------------------- +# STAGE 0: Fetch Julia Natively (Bypasses execstack OS bug) +# --------------------------------------------------------- +FROM julia:1.10.4 AS julia-base + # --------------------------------------------------------- # STAGE 1: The Maximal Base (All dependencies baked in) # --------------------------------------------------------- @@ -7,24 +12,35 @@ SHELL ["/bin/bash", "-c"] ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 -# 1. Install ALL system dependencies together to save layers +# 1. Install ALL system dependencies together +# Includes R dependencies: pkg-config, libuv1-dev, libxml2-dev, etc. RUN apt-get update && apt-get install -y --no-install-recommends \ curl build-essential git ssh sudo wget zip unzip \ sed \ ccls \ fpc fpc-source \ - libcurl4-openssl-dev \ + libcurl4-openssl-dev libssl-dev libicu-dev zlib1g-dev \ + pkg-config libuv1-dev libxml2-dev \ cpanminus libanyevent-perl libio-aio-perl \ default-jdk \ ruby-full \ golang-go \ + r-base \ && rm -rf /var/lib/apt/lists/* -# 2. Install pipx -RUN python3 -m pip install --no-cache-dir pipx \ - && pipx ensurepath +# 2. Install pipx (Removed ensurepath to prevent process ID out of range warnings) +RUN python3 -m pip install --no-cache-dir pipx +ENV PATH="/root/.local/bin:${PATH}" + +# 3. Copy Julia from official image and install Language Server +COPY --from=julia-base /usr/local/julia /opt/julia +RUN ln -s /opt/julia/bin/julia /usr/local/bin/julia \ + && julia -e 'using Pkg; Pkg.add("LanguageServer")' -# 3. Install Node.js & Elm (From yaml) +# 4. Install R Language Server +RUN Rscript -e "install.packages('languageserver', repos='https://cloud.r-project.org')" + +# 5. Install Node.js and Elm ENV NVM_VERSION=0.40.3 ENV NODE_VERSION=22.18.0 RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v${NVM_VERSION}/install.sh | bash @@ -35,13 +51,10 @@ RUN . "$NVM_DIR/nvm.sh" && nvm install ${NODE_VERSION} \ && npm install -g elm@0.19.1-6 ENV PATH="${NVM_DIR}/versions/node/v${NODE_VERSION}/bin/:${PATH}" -# Add local bin to the path -ENV PATH="${PATH}:/root/.local/bin" - -# 4. Install uv +# 6. Install uv RUN curl -LsSf https://astral.sh/uv/install.sh | sh -# 5. Install Rust +# 7. Install Rust ENV RUSTUP_HOME=/usr/local/rustup ENV CARGO_HOME=/usr/local/cargo ENV PATH="${CARGO_HOME}/bin:${PATH}" @@ -50,45 +63,23 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \ --profile minimal \ && rustup component add rust-analyzer -# 6. Install Go gopls (From yaml) +# 8. Install Go gopls RUN go install golang.org/x/tools/gopls@latest ENV PATH="/root/go/bin:${PATH}" -# 7. Install Ruby LSP (From yaml) +# 9. Install Ruby LSP RUN gem install ruby-lsp -# 8. Install Perl Language Server (From yaml) +# 10. Install Perl Language Server RUN PERL_MM_USE_DEFAULT=1 cpanm --notest --force Perl::LanguageServer -# --------------------------------------------------------- -# STAGE 1.5: Additional Languages and Tools -# --------------------------------------------------------- - -# Install Terraform +# 11. Install Terraform RUN wget https://releases.hashicorp.com/terraform/1.5.0/terraform_1.5.0_linux_amd64.zip \ && unzip terraform_1.5.0_linux_amd64.zip \ && mv terraform /usr/local/bin/ \ && rm terraform_1.5.0_linux_amd64.zip -# Install R and R Language Server -RUN apt-get update && apt-get install -y r-base \ - && Rscript -e "install.packages('languageserver', repos='https://cloud.r-project.org')" \ - && rm -rf /var/lib/apt/lists/* - -# --------------------------------------------------------- -# --------------------------------------------------------- -# Install Julia and Julia Language Server. -# Upgraded to version 1.10.4 to natively bypass the known -# executable stack bug present in the 1.10.0 release. -# --------------------------------------------------------- -RUN curl -L https://julialang-s3.julialang.org/bin/linux/x64/1.10/julia-1.10.4-linux-x86_64.tar.gz -o julia.tar.gz \ - && mkdir -p /opt/julia \ - && tar -xzf julia.tar.gz -C /opt/julia --strip-components=1 \ - && rm julia.tar.gz \ - && ln -s /opt/julia/bin/julia /usr/local/bin/julia \ - && julia -e 'using Pkg; Pkg.add("LanguageServer")' - -# Install Zig and ZLS (Zig Language Server) +# 12. Install Zig and ZLS (Zig Language Server) RUN wget https://github.com/zigtools/zls/releases/download/0.14.0/zls-x86_64-linux.tar.xz \ && tar -xf zls-x86_64-linux.tar.xz \ && mv zls /usr/local/bin/ \ @@ -97,7 +88,7 @@ RUN wget https://github.com/zigtools/zls/releases/download/0.14.0/zls-x86_64-lin && tar -xf zig-linux-x86_64-0.14.0.tar.xz -C /usr/local --strip-components=1 \ && rm zig-linux-x86_64-0.14.0.tar.xz -# Install Lua Language Server +# 13. Install Lua Language Server ENV LUA_LS_VERSION="3.15.0" RUN mkdir -p /opt/lua-ls \ && wget https://github.com/LuaLS/lua-language-server/releases/download/${LUA_LS_VERSION}/lua-language-server-${LUA_LS_VERSION}-linux-x64.tar.gz \ @@ -106,7 +97,7 @@ RUN mkdir -p /opt/lua-ls \ && chmod +x /opt/lua-ls/bin/lua-language-server \ && ln -s /opt/lua-ls/bin/lua-language-server /usr/local/bin/lua-language-server -# Install Regal (Rego Language Server) +# 14. Install Regal (Rego Language Server) ENV REGAL_VERSION="0.39.0" RUN curl -L -o regal https://github.com/StyraInc/regal/releases/download/v${REGAL_VERSION}/regal_Linux_x86_64 \ && chmod +x regal \ @@ -128,7 +119,7 @@ RUN sed -i 's/^gui_log_window: .*/gui_log_window: False/' $SERENA_HOME/serena_co RUN sed -i 's/^web_dashboard_listen_address: .*/web_dashboard_listen_address: 0.0.0.0/' $SERENA_HOME/serena_config.yml RUN sed -i 's/^web_dashboard_open_on_launch: .*/web_dashboard_open_on_launch: False/' $SERENA_HOME/serena_config.yml -# Create virtual environment and install dependencies (including ansible from yaml) +# Create virtual environment and install dependencies RUN uv venv RUN . .venv/bin/activate \ && uv pip install -r pyproject.toml -e . \ From 0a347ab72d82cc2fcde4d35b903c1bd99d6723ed Mon Sep 17 00:00:00 2001 From: tirthpatel90 Date: Mon, 13 Apr 2026 21:08:15 +0530 Subject: [PATCH 07/16] Force-install execstack from archives to bypass Debian 12 Docker security for Julia --- Dockerfile.maximal | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Dockerfile.maximal b/Dockerfile.maximal index c7d8b1b66..8a38223eb 100644 --- a/Dockerfile.maximal +++ b/Dockerfile.maximal @@ -1,8 +1,3 @@ -# --------------------------------------------------------- -# STAGE 0: Fetch Julia Natively (Bypasses execstack OS bug) -# --------------------------------------------------------- -FROM julia:1.10.4 AS julia-base - # --------------------------------------------------------- # STAGE 1: The Maximal Base (All dependencies baked in) # --------------------------------------------------------- @@ -32,9 +27,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ RUN python3 -m pip install --no-cache-dir pipx ENV PATH="/root/.local/bin:${PATH}" -# 3. Copy Julia from official image and install Language Server -COPY --from=julia-base /usr/local/julia /opt/julia -RUN ln -s /opt/julia/bin/julia /usr/local/bin/julia \ +# 3. Force-install execstack from archives, setup Julia, clear flag, and cleanup +RUN curl -L https://julialang-s3.julialang.org/bin/linux/x64/1.10/julia-1.10.4-linux-x86_64.tar.gz -o julia.tar.gz \ + && mkdir -p /opt/julia \ + && tar -xzf julia.tar.gz -C /opt/julia --strip-components=1 \ + && rm julia.tar.gz \ + && curl -O http://ftp.us.debian.org/debian/pool/main/p/prelink/execstack_0.0.20131005-1+b10_amd64.deb \ + && dpkg -i execstack*.deb \ + && rm execstack*.deb \ + && execstack -c /opt/julia/lib/julia/libopenlibm.so \ + && ln -s /opt/julia/bin/julia /usr/local/bin/julia \ && julia -e 'using Pkg; Pkg.add("LanguageServer")' # 4. Install R Language Server From 900ee9e66ae928ef92e68b98ccbd22b2ac9902e0 Mon Sep 17 00:00:00 2001 From: tirthpatel90 Date: Mon, 13 Apr 2026 21:14:19 +0530 Subject: [PATCH 08/16] Fix Julia install using proper Docker multi-stage build --- Dockerfile.maximal | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Dockerfile.maximal b/Dockerfile.maximal index 8a38223eb..335015910 100644 --- a/Dockerfile.maximal +++ b/Dockerfile.maximal @@ -1,3 +1,8 @@ +# --------------------------------------------------------- +# STAGE 0: Fetch Julia Natively (Bypasses OS bugs completely) +# --------------------------------------------------------- +FROM julia:1.10.4 AS julia-base + # --------------------------------------------------------- # STAGE 1: The Maximal Base (All dependencies baked in) # --------------------------------------------------------- @@ -27,16 +32,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ RUN python3 -m pip install --no-cache-dir pipx ENV PATH="/root/.local/bin:${PATH}" -# 3. Force-install execstack from archives, setup Julia, clear flag, and cleanup -RUN curl -L https://julialang-s3.julialang.org/bin/linux/x64/1.10/julia-1.10.4-linux-x86_64.tar.gz -o julia.tar.gz \ - && mkdir -p /opt/julia \ - && tar -xzf julia.tar.gz -C /opt/julia --strip-components=1 \ - && rm julia.tar.gz \ - && curl -O http://ftp.us.debian.org/debian/pool/main/p/prelink/execstack_0.0.20131005-1+b10_amd64.deb \ - && dpkg -i execstack*.deb \ - && rm execstack*.deb \ - && execstack -c /opt/julia/lib/julia/libopenlibm.so \ - && ln -s /opt/julia/bin/julia /usr/local/bin/julia \ +# 3. Copy Julia from official image and install Language Server +COPY --from=julia-base /usr/local/julia /opt/julia +RUN ln -s /opt/julia/bin/julia /usr/local/bin/julia \ && julia -e 'using Pkg; Pkg.add("LanguageServer")' # 4. Install R Language Server From 90749bb0f277480b663366fc4c5fb6bbc124389e Mon Sep 17 00:00:00 2001 From: tirthpatel90 Date: Mon, 13 Apr 2026 21:22:59 +0530 Subject: [PATCH 09/16] Fix Julia executable stack bug using Ubuntu prelink archive --- Dockerfile.maximal | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Dockerfile.maximal b/Dockerfile.maximal index 335015910..9de8a4f04 100644 --- a/Dockerfile.maximal +++ b/Dockerfile.maximal @@ -1,8 +1,3 @@ -# --------------------------------------------------------- -# STAGE 0: Fetch Julia Natively (Bypasses OS bugs completely) -# --------------------------------------------------------- -FROM julia:1.10.4 AS julia-base - # --------------------------------------------------------- # STAGE 1: The Maximal Base (All dependencies baked in) # --------------------------------------------------------- @@ -28,13 +23,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ r-base \ && rm -rf /var/lib/apt/lists/* -# 2. Install pipx (Removed ensurepath to prevent process ID out of range warnings) +# 2. Install pipx RUN python3 -m pip install --no-cache-dir pipx ENV PATH="/root/.local/bin:${PATH}" -# 3. Copy Julia from official image and install Language Server -COPY --from=julia-base /usr/local/julia /opt/julia -RUN ln -s /opt/julia/bin/julia /usr/local/bin/julia \ +# 3. Install Julia and patch the executable stack bug using Ubuntu's execstack +RUN curl -L https://julialang-s3.julialang.org/bin/linux/x64/1.10/julia-1.10.4-linux-x86_64.tar.gz -o julia.tar.gz \ + && mkdir -p /opt/julia \ + && tar -xzf julia.tar.gz -C /opt/julia --strip-components=1 \ + && rm julia.tar.gz \ + && wget http://archive.ubuntu.com/ubuntu/pool/universe/p/prelink/execstack_0.0.20131005-1_amd64.deb \ + && dpkg -i execstack_0.0.20131005-1_amd64.deb \ + && rm execstack_0.0.20131005-1_amd64.deb \ + && execstack -c /opt/julia/lib/julia/libopenlibm.so \ + && execstack -c /opt/julia/lib/julia/sys.so || true \ + && ln -s /opt/julia/bin/julia /usr/local/bin/julia \ && julia -e 'using Pkg; Pkg.add("LanguageServer")' # 4. Install R Language Server From 7df086396ad8717c40dcdb946d6400990581109d Mon Sep 17 00:00:00 2001 From: tirthpatel90 Date: Tue, 14 Apr 2026 11:00:39 +0530 Subject: [PATCH 10/16] Optimize Julia memory footprint and switch to pre-compiled R binaries to drastically reduce build time --- Dockerfile.maximal | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile.maximal b/Dockerfile.maximal index 9de8a4f04..4a6e99df7 100644 --- a/Dockerfile.maximal +++ b/Dockerfile.maximal @@ -23,11 +23,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ r-base \ && rm -rf /var/lib/apt/lists/* -# 2. Install pipx +# 2. Install pipx (Removed ensurepath to prevent process ID out of range warnings) RUN python3 -m pip install --no-cache-dir pipx ENV PATH="/root/.local/bin:${PATH}" -# 3. Install Julia and patch the executable stack bug using Ubuntu's execstack +# 3. Install Julia and patch the executable stack bug +# Added CPU constraints to prevent GitHub Actions Out-Of-Memory (OOM) freeze +ENV JULIA_NUM_THREADS=1 +ENV JULIA_CPU_THREADS=1 RUN curl -L https://julialang-s3.julialang.org/bin/linux/x64/1.10/julia-1.10.4-linux-x86_64.tar.gz -o julia.tar.gz \ && mkdir -p /opt/julia \ && tar -xzf julia.tar.gz -C /opt/julia --strip-components=1 \ @@ -41,7 +44,8 @@ RUN curl -L https://julialang-s3.julialang.org/bin/linux/x64/1.10/julia-1.10.4-l && julia -e 'using Pkg; Pkg.add("LanguageServer")' # 4. Install R Language Server -RUN Rscript -e "install.packages('languageserver', repos='https://cloud.r-project.org')" +# Switched to Posit Public Package Manager (Debian 12 Bookworm) for pre-compiled binaries +RUN Rscript -e "install.packages('languageserver', repos='https://packagemanager.posit.co/cran/__linux__/bookworm/latest')" # 5. Install Node.js and Elm ENV NVM_VERSION=0.40.3 From 9c0425f468b76320b6eb7c13f375fae7b8fedc95 Mon Sep 17 00:00:00 2001 From: tirthpatel90 Date: Tue, 14 Apr 2026 18:22:39 +0530 Subject: [PATCH 11/16] Disable Julia auto-precompilation and set noninteractive frontend to fix 6-hour infinite hang --- Dockerfile.maximal | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Dockerfile.maximal b/Dockerfile.maximal index 4a6e99df7..d6c25217d 100644 --- a/Dockerfile.maximal +++ b/Dockerfile.maximal @@ -7,8 +7,10 @@ SHELL ["/bin/bash", "-c"] ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 +# Prevent apt-get from hanging indefinitely on interactive prompts (like timezone) +ARG DEBIAN_FRONTEND=noninteractive + # 1. Install ALL system dependencies together -# Includes R dependencies: pkg-config, libuv1-dev, libxml2-dev, etc. RUN apt-get update && apt-get install -y --no-install-recommends \ curl build-essential git ssh sudo wget zip unzip \ sed \ @@ -23,14 +25,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ r-base \ && rm -rf /var/lib/apt/lists/* -# 2. Install pipx (Removed ensurepath to prevent process ID out of range warnings) +# 2. Install pipx RUN python3 -m pip install --no-cache-dir pipx ENV PATH="/root/.local/bin:${PATH}" -# 3. Install Julia and patch the executable stack bug -# Added CPU constraints to prevent GitHub Actions Out-Of-Memory (OOM) freeze +# 3. Install Julia (Bypass Precompilation Hang) +# Setting JULIA_PKG_PRECOMPILE_AUTO=0 prevents the silent OOM hang during Docker build ENV JULIA_NUM_THREADS=1 ENV JULIA_CPU_THREADS=1 +ENV JULIA_PKG_PRECOMPILE_AUTO=0 RUN curl -L https://julialang-s3.julialang.org/bin/linux/x64/1.10/julia-1.10.4-linux-x86_64.tar.gz -o julia.tar.gz \ && mkdir -p /opt/julia \ && tar -xzf julia.tar.gz -C /opt/julia --strip-components=1 \ @@ -43,8 +46,7 @@ RUN curl -L https://julialang-s3.julialang.org/bin/linux/x64/1.10/julia-1.10.4-l && ln -s /opt/julia/bin/julia /usr/local/bin/julia \ && julia -e 'using Pkg; Pkg.add("LanguageServer")' -# 4. Install R Language Server -# Switched to Posit Public Package Manager (Debian 12 Bookworm) for pre-compiled binaries +# 4. Install R Language Server (Using Pre-compiled Binaries) RUN Rscript -e "install.packages('languageserver', repos='https://packagemanager.posit.co/cran/__linux__/bookworm/latest')" # 5. Install Node.js and Elm From b35251978ef43cd106cdc008b16807a7de2a4eae Mon Sep 17 00:00:00 2001 From: tirthpatel90 Date: Tue, 14 Apr 2026 18:44:23 +0530 Subject: [PATCH 12/16] chore: remove test workflow file --- .github/workflows/test-docker.yml | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 .github/workflows/test-docker.yml diff --git a/.github/workflows/test-docker.yml b/.github/workflows/test-docker.yml deleted file mode 100644 index 9da897a7d..000000000 --- a/.github/workflows/test-docker.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Test Maximal Docker Build - -on: - push: - branches: - - feature/optimize-docker-ci # Yeh sirf teri branch par chalega - -jobs: - test-build: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Free disk space (Zaruri hai warna server full ho jayega) - run: | - df -h - sudo rm -rf /usr/local/lib/android - sudo rm -rf /usr/share/dotnet - sudo rm -rf /opt/ghc - docker system prune -af || true - - - name: Build the Monster Maximal Image - run: | - echo "Building the maximal image. Let's go!" - docker build -t serena-maximal -f Dockerfile.maximal . \ No newline at end of file From 6a6a0470aac75934d05779542dec5be152fdbd6d Mon Sep 17 00:00:00 2001 From: tirthpatel90 Date: Wed, 15 Apr 2026 21:54:54 +0530 Subject: [PATCH 13/16] feat: Add OCaml support to maximal image --- Dockerfile.maximal | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Dockerfile.maximal b/Dockerfile.maximal index d6c25217d..2d5f4f7db 100644 --- a/Dockerfile.maximal +++ b/Dockerfile.maximal @@ -7,7 +7,7 @@ SHELL ["/bin/bash", "-c"] ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 -# Prevent apt-get from hanging indefinitely on interactive prompts (like timezone) +# Prevent apt-get from hanging indefinitely on interactive prompts ARG DEBIAN_FRONTEND=noninteractive # 1. Install ALL system dependencies together @@ -23,6 +23,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ ruby-full \ golang-go \ r-base \ + opam \ && rm -rf /var/lib/apt/lists/* # 2. Install pipx @@ -30,7 +31,6 @@ RUN python3 -m pip install --no-cache-dir pipx ENV PATH="/root/.local/bin:${PATH}" # 3. Install Julia (Bypass Precompilation Hang) -# Setting JULIA_PKG_PRECOMPILE_AUTO=0 prevents the silent OOM hang during Docker build ENV JULIA_NUM_THREADS=1 ENV JULIA_CPU_THREADS=1 ENV JULIA_PKG_PRECOMPILE_AUTO=0 @@ -88,7 +88,7 @@ RUN wget https://releases.hashicorp.com/terraform/1.5.0/terraform_1.5.0_linux_am && mv terraform /usr/local/bin/ \ && rm terraform_1.5.0_linux_amd64.zip -# 12. Install Zig and ZLS (Zig Language Server) +# 12. Install Zig and ZLS RUN wget https://github.com/zigtools/zls/releases/download/0.14.0/zls-x86_64-linux.tar.xz \ && tar -xf zls-x86_64-linux.tar.xz \ && mv zls /usr/local/bin/ \ @@ -112,6 +112,13 @@ RUN curl -L -o regal https://github.com/StyraInc/regal/releases/download/v${REGA && chmod +x regal \ && mv regal /usr/local/bin/ +# 15. Install OCaml, Dune, and OCaml-LSP-Server +# Disable sandboxing for Docker compatibility +RUN opam init -a -y --disable-sandboxing \ + && eval $(opam env) \ + && opam install -y dune 'ocaml-lsp-server>=1.23.0' +ENV PATH="/root/.opam/default/bin:${PATH}" + # --------------------------------------------------------- # STAGE 2: Serena App Setup # --------------------------------------------------------- From 8447e987177b5402d4174c89d5484748566e5054 Mon Sep 17 00:00:00 2001 From: tirthpatel90 Date: Wed, 15 Apr 2026 22:00:28 +0530 Subject: [PATCH 14/16] ci: add workflow to publish maximal image to ghcr --- .github/workflows/publish-maximal.yml | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/publish-maximal.yml diff --git a/.github/workflows/publish-maximal.yml b/.github/workflows/publish-maximal.yml new file mode 100644 index 000000000..fdc1069da --- /dev/null +++ b/.github/workflows/publish-maximal.yml @@ -0,0 +1,42 @@ +name: Publish Maximal Docker Image + +on: + push: + branches: + - feature/optimize-docker-ci + workflow_dispatch: # for manual run from GitHub UI + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + + # permission to upload the image to GitHub Container Registry + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.maximal + push: true + # this will tag the image as latest, you can also add more tags if needed + tags: ghcr.io/tirthpatel90/serena-maximal:latest + # Caching on for future runs, this will speed up the build process by reusing layers + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file From 281c890d6949ced0a32fd96466b30e604c1bc4b2 Mon Sep 17 00:00:00 2001 From: tirthpatel90 Date: Fri, 17 Apr 2026 21:11:30 +0530 Subject: [PATCH 15/16] ci: add workflow to test maximal docker image speed --- .github/workflows/test-maximal.yml | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/test-maximal.yml diff --git a/.github/workflows/test-maximal.yml b/.github/workflows/test-maximal.yml new file mode 100644 index 000000000..e88b62f54 --- /dev/null +++ b/.github/workflows/test-maximal.yml @@ -0,0 +1,34 @@ +name: Test with Maximal Image + +on: + push: + branches: + - feature/optimize-docker-ci + workflow_dispatch: + +jobs: + fast-docker-test: + name: Linux Tests (Containerized) + runs-on: ubuntu-latest + + container: + image: ghcr.io/tirthpatel90/serena-maximal:latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Quick Workspace Sync + shell: bash + run: | + # Sirf code update karne ke liye fast sync (takes 2 seconds) + uv sync --extra dev --locked + uv pip list + + - name: Test with pytest (Lightning Fast) + shell: bash + run: uv run poe test -q --tb=short + + - name: Type-checking with mypy + shell: bash + run: uv run poe type-check \ No newline at end of file From c51f8968774752dbeba95f13bbea7be3fc67d114 Mon Sep 17 00:00:00 2001 From: tirthpatel90 Date: Fri, 17 Apr 2026 22:10:00 +0530 Subject: [PATCH 16/16] ci: fix github advanced security permission warnings --- .github/workflows/test-maximal.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-maximal.yml b/.github/workflows/test-maximal.yml index e88b62f54..fa5a52153 100644 --- a/.github/workflows/test-maximal.yml +++ b/.github/workflows/test-maximal.yml @@ -6,11 +6,16 @@ on: - feature/optimize-docker-ci workflow_dispatch: +# Added permissions block to resolve GitHub Advanced Security warning +permissions: + contents: read + jobs: fast-docker-test: name: Linux Tests (Containerized) runs-on: ubuntu-latest + # Execute the workflow directly inside the pre-built maximal container container: image: ghcr.io/tirthpatel90/serena-maximal:latest @@ -21,11 +26,11 @@ jobs: - name: Quick Workspace Sync shell: bash run: | - # Sirf code update karne ke liye fast sync (takes 2 seconds) + # Perform a rapid workspace sync (bypasses heavy toolchain installations) uv sync --extra dev --locked uv pip list - - name: Test with pytest (Lightning Fast) + - name: Test with pytest (Optimized) shell: bash run: uv run poe test -q --tb=short