You've already forked pgbackrest
							
							
				mirror of
				https://github.com/pgbackrest/pgbackrest.git
				synced 2025-10-30 23:37:45 +02:00 
			
		
		
		
	The tests worked fine on multiple architectures, but would only run "bare metal", i.e. tests that required containers could not be run. Enable basic multi-architecture support by allowing containers to be built using whatever architecture the host supports. Also allow cached containers to be defined for multiple architectures in container.yaml. Add a Dockerfile which can be used as a container for other containers to provide a consistent development environment. The primary goal is to allow development on Mac M1 but other architectures should find these improvements useful.
		
			
				
	
	
		
			41 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Docker
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Docker
		
	
	
	
	
	
| # Force remove all containers:
 | |
| # docker rm -f $(docker ps -a -q)
 | |
| # Force remove all images:
 | |
| # docker rmi -f $(docker images -q)
 | |
| #
 | |
| # export PGB=pgbackrest;export PGB_IMAGE=$PGB/test:u20-main;PGB_REPO=~/Documents/Code/$PGB
 | |
| # docker build -f $PGB_REPO/test/Dockerfile -t $PGB_IMAGE .
 | |
| # docker run --privileged -itd --name $PGB-test -h $PGB-test -v $PGB_REPO:/home/docker/$PGB $PGB_IMAGE
 | |
| 
 | |
| FROM ubuntu:focal
 | |
| 
 | |
| # Suppress "dpkg-reconfigure: unable to re-open stdin: No file or directory" warning
 | |
| RUN export DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_FRONTEND=noninteractive && \
 | |
| 
 | |
| # Install packages
 | |
|     apt-get update && \
 | |
|     apt-get install -y \
 | |
|         sudo vim htop jq rsync sysstat \
 | |
|         libdbd-pg-perl libxml-checker-perl libyaml-perl \
 | |
|         devscripts build-essential lintian git cloc txt2man debhelper libssl-dev zlib1g-dev libperl-dev libxml2-dev liblz4-dev \
 | |
|         liblz4-tool libpq-dev valgrind lcov autoconf-archive zstd libzstd-dev bzip2 libbz2-dev pkg-config && \
 | |
| 
 | |
| # Install Docker
 | |
|     groupadd -g5000 docker && \
 | |
|     curl -fsSL https://get.docker.com | sh && \
 | |
| 
 | |
| # Create docker user
 | |
|     adduser --ingroup=docker -uid=5000 --disabled-password --gecos \"\" docker && \
 | |
| 
 | |
| # Configure sudo
 | |
|     echo '%docker ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \
 | |
| 
 | |
| # Mount tmpfs at /home/docker/test for faster testing
 | |
|     sudo -u docker mkdir -m 770 /home/docker/test && \
 | |
|     echo 'tmpfs /home/docker/test tmpfs size=4096M 0 1' >> /etc/fstab
 | |
| 
 | |
| USER docker
 | |
| WORKDIR /home/docker
 | |
| 
 | |
| ENTRYPOINT sudo rm -f /var/run/docker.pid && sudo mount -a && sudo dockerd
 |