Update codespell target (#6223)
- Use the local user to install and run so that root does not own the artifacts. - Move the python image into a place renovate can maintain it.
This commit is contained in:
		
							parent
							
								
									d10a36beba
								
							
						
					
					
						commit
						1994f6370b
					
				|  | @ -1,6 +1,7 @@ | ||||||
| .DS_Store | .DS_Store | ||||||
| Thumbs.db | Thumbs.db | ||||||
| 
 | 
 | ||||||
|  | .cache/ | ||||||
| .tools/ | .tools/ | ||||||
| venv/ | venv/ | ||||||
| .idea/ | .idea/ | ||||||
|  |  | ||||||
							
								
								
									
										12
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										12
									
								
								Makefile
								
								
								
								
							|  | @ -11,6 +11,10 @@ ALL_COVERAGE_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} | ||||||
| GO = go | GO = go | ||||||
| TIMEOUT = 60 | TIMEOUT = 60 | ||||||
| 
 | 
 | ||||||
|  | # User to run as in docker images.
 | ||||||
|  | DOCKER_USER=$(shell id -u):$(shell id -g) | ||||||
|  | DEPENDENCIES_DOCKERFILE=./dependencies.Dockerfile | ||||||
|  | 
 | ||||||
| .DEFAULT_GOAL := precommit | .DEFAULT_GOAL := precommit | ||||||
| 
 | 
 | ||||||
| .PHONY: precommit ci | .PHONY: precommit ci | ||||||
|  | @ -81,20 +85,20 @@ PIP := $(PYTOOLS)/pip | ||||||
| WORKDIR := /workdir | WORKDIR := /workdir | ||||||
| 
 | 
 | ||||||
| # The python image to use for the virtual environment.
 | # The python image to use for the virtual environment.
 | ||||||
| PYTHONIMAGE := python:3.11.3-slim-bullseye | PYTHONIMAGE := $(shell awk '$$4=="python" {print $$2}' $(DEPENDENCIES_DOCKERFILE)) | ||||||
| 
 | 
 | ||||||
| # Run the python image with the current directory mounted.
 | # Run the python image with the current directory mounted.
 | ||||||
| DOCKERPY := docker run --rm -v "$(CURDIR):$(WORKDIR)" -w $(WORKDIR) $(PYTHONIMAGE) | DOCKERPY := docker run --rm -u $(DOCKER_USER) -v "$(CURDIR):$(WORKDIR)" -w $(WORKDIR) $(PYTHONIMAGE) | ||||||
| 
 | 
 | ||||||
| # Create a virtual environment for Python tools.
 | # Create a virtual environment for Python tools.
 | ||||||
| $(PYTOOLS): | $(PYTOOLS): | ||||||
| # The `--upgrade` flag is needed to ensure that the virtual environment is
 | # The `--upgrade` flag is needed to ensure that the virtual environment is
 | ||||||
| # created with the latest pip version.
 | # created with the latest pip version.
 | ||||||
| 	@$(DOCKERPY) bash -c "python3 -m venv $(VENVDIR) && $(PIP) install --upgrade pip" | 	@$(DOCKERPY) bash -c "python3 -m venv $(VENVDIR) && $(PIP) install --upgrade --cache-dir=$(WORKDIR)/.cache/pip pip" | ||||||
| 
 | 
 | ||||||
| # Install python packages into the virtual environment.
 | # Install python packages into the virtual environment.
 | ||||||
| $(PYTOOLS)/%: $(PYTOOLS) | $(PYTOOLS)/%: $(PYTOOLS) | ||||||
| 	@$(DOCKERPY) $(PIP) install -r requirements.txt | 	@$(DOCKERPY) $(PIP) install --cache-dir=$(WORKDIR)/.cache/pip -r requirements.txt | ||||||
| 
 | 
 | ||||||
| CODESPELL = $(PYTOOLS)/codespell | CODESPELL = $(PYTOOLS)/codespell | ||||||
| $(CODESPELL): PACKAGE=codespell | $(CODESPELL): PACKAGE=codespell | ||||||
|  |  | ||||||
|  | @ -0,0 +1,2 @@ | ||||||
|  | # This is a renovate-friendly source of Docker images. | ||||||
|  | FROM python:3.13.1-slim-bullseye AS python | ||||||
		Loading…
	
		Reference in New Issue