mirror of
				https://github.com/XRPLF/clio.git
				synced 2025-11-04 11:55:51 +00:00 
			
		
		
		
	chore: Add separate pre-commit image (#2677)
This commit is contained in:
		
							
								
								
									
										22
									
								
								.github/workflows/update-docker-ci.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										22
									
								
								.github/workflows/update-docker-ci.yml
									
									
									
									
										vendored
									
									
								
							@@ -306,6 +306,28 @@ jobs:
 | 
				
			|||||||
            $image:arm64-latest \
 | 
					            $image:arm64-latest \
 | 
				
			||||||
            $image:amd64-latest
 | 
					            $image:amd64-latest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  pre-commit:
 | 
				
			||||||
 | 
					    name: Build and push pre-commit docker image
 | 
				
			||||||
 | 
					    runs-on: heavy
 | 
				
			||||||
 | 
					    needs: [repo, tools-merge]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      - uses: actions/checkout@v4
 | 
				
			||||||
 | 
					      - uses: ./.github/actions/build-docker-image
 | 
				
			||||||
 | 
					        env:
 | 
				
			||||||
 | 
					          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          images: |
 | 
				
			||||||
 | 
					            ${{ needs.repo.outputs.GHCR_REPO }}/clio-pre-commit
 | 
				
			||||||
 | 
					          push_image: ${{ github.event_name != 'pull_request' }}
 | 
				
			||||||
 | 
					          directory: docker/pre-commit
 | 
				
			||||||
 | 
					          tags: |
 | 
				
			||||||
 | 
					            type=raw,value=latest
 | 
				
			||||||
 | 
					            type=raw,value=${{ github.sha }}
 | 
				
			||||||
 | 
					          platforms: linux/amd64,linux/arm64
 | 
				
			||||||
 | 
					          build_args: |
 | 
				
			||||||
 | 
					            GHCR_REPO=${{ needs.repo.outputs.GHCR_REPO }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ci:
 | 
					  ci:
 | 
				
			||||||
    name: Build and push CI docker image
 | 
					    name: Build and push CI docker image
 | 
				
			||||||
    runs-on: heavy
 | 
					    runs-on: heavy
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -43,7 +43,7 @@ repos:
 | 
				
			|||||||
        # hadolint-docker is a special hook that runs hadolint in a Docker container
 | 
					        # hadolint-docker is a special hook that runs hadolint in a Docker container
 | 
				
			||||||
        # Docker is not installed in the environment where pre-commit is run
 | 
					        # Docker is not installed in the environment where pre-commit is run
 | 
				
			||||||
        stages: [manual]
 | 
					        stages: [manual]
 | 
				
			||||||
        entry: hadolint/hadolint:v2.14 hadolint
 | 
					        entry: hadolint/hadolint:v2.14.0 hadolint
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  - repo: https://github.com/codespell-project/codespell
 | 
					  - repo: https://github.com/codespell-project/codespell
 | 
				
			||||||
    rev: 63c8f8312b7559622c0d82815639671ae42132ac # frozen: v2.4.1
 | 
					    rev: 63c8f8312b7559622c0d82815639671ae42132ac # frozen: v2.4.1
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -43,26 +43,20 @@ RUN apt-get update \
 | 
				
			|||||||
    && rm -rf /var/lib/apt/lists/*
 | 
					    && rm -rf /var/lib/apt/lists/*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Install Python tools
 | 
					# Install Python tools
 | 
				
			||||||
ARG PYTHON_VERSION=3.13
 | 
					RUN apt-get update \
 | 
				
			||||||
 | 
					 | 
				
			||||||
RUN add-apt-repository ppa:deadsnakes/ppa \
 | 
					 | 
				
			||||||
    && apt-get update \
 | 
					 | 
				
			||||||
    && apt-get install -y --no-install-recommends --no-install-suggests \
 | 
					    && apt-get install -y --no-install-recommends --no-install-suggests \
 | 
				
			||||||
        python${PYTHON_VERSION} \
 | 
					        python3 \
 | 
				
			||||||
        python${PYTHON_VERSION}-venv \
 | 
					        python3-pip \
 | 
				
			||||||
    && apt-get clean \
 | 
					    && apt-get clean \
 | 
				
			||||||
    && rm -rf /var/lib/apt/lists/* \
 | 
					    && rm -rf /var/lib/apt/lists/*
 | 
				
			||||||
    && curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Create a virtual environment for python tools
 | 
					 | 
				
			||||||
RUN python${PYTHON_VERSION} -m venv /opt/venv
 | 
					 | 
				
			||||||
ENV PATH="/opt/venv/bin:$PATH"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
RUN pip install -q --no-cache-dir \
 | 
					RUN pip install -q --no-cache-dir \
 | 
				
			||||||
 | 
					        # TODO: Remove this once we switch to newer Ubuntu base image
 | 
				
			||||||
 | 
					        # lxml 6.0.0 is not compatible with our image
 | 
				
			||||||
 | 
					        'lxml<6.0.0' \
 | 
				
			||||||
        cmake \
 | 
					        cmake \
 | 
				
			||||||
        conan==2.20.1 \
 | 
					        conan==2.20.1 \
 | 
				
			||||||
        gcovr \
 | 
					        gcovr
 | 
				
			||||||
        pre-commit
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Install LLVM tools
 | 
					# Install LLVM tools
 | 
				
			||||||
ARG LLVM_TOOLS_VERSION=20
 | 
					ARG LLVM_TOOLS_VERSION=20
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										36
									
								
								docker/pre-commit/Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								docker/pre-commit/Dockerfile
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
				
			|||||||
 | 
					ARG GHCR_REPO=invalid
 | 
				
			||||||
 | 
					FROM ${GHCR_REPO}/clio-tools:latest AS clio-tools
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# We're using Ubuntu 24.04 to have a more recent version of Python
 | 
				
			||||||
 | 
					FROM ubuntu:24.04
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ARG DEBIAN_FRONTEND=noninteractive
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SHELL ["/bin/bash", "-o", "pipefail", "-c"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# hadolint ignore=DL3002
 | 
				
			||||||
 | 
					USER root
 | 
				
			||||||
 | 
					WORKDIR /root
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Install common tools and dependencies
 | 
				
			||||||
 | 
					RUN apt-get update \
 | 
				
			||||||
 | 
					    && apt-get install -y --no-install-recommends --no-install-suggests \
 | 
				
			||||||
 | 
					        curl \
 | 
				
			||||||
 | 
					        software-properties-common \
 | 
				
			||||||
 | 
					    && apt-get clean \
 | 
				
			||||||
 | 
					    && rm -rf /var/lib/apt/lists/*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Install Python tools
 | 
				
			||||||
 | 
					RUN apt-get update \
 | 
				
			||||||
 | 
					    && apt-get install -y --no-install-recommends --no-install-suggests \
 | 
				
			||||||
 | 
					        python3 \
 | 
				
			||||||
 | 
					        python3-pip \
 | 
				
			||||||
 | 
					    && apt-get clean \
 | 
				
			||||||
 | 
					    && rm -rf /var/lib/apt/lists/*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN pip install -q --no-cache-dir --break-system-packages \
 | 
				
			||||||
 | 
					        pre-commit
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					COPY --from=clio-tools \
 | 
				
			||||||
 | 
					    /usr/local/bin/doxygen \
 | 
				
			||||||
 | 
					    /usr/local/bin/
 | 
				
			||||||
		Reference in New Issue
	
	Block a user