2
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| FROM spark.builder | ||||
| COPY ./build /build | ||||
							
								
								
									
										17
									
								
								build
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										17
									
								
								build
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| #!/usr/bin/env bash | ||||
| # The builder user is already created in the rootfs | ||||
|  | ||||
| export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin | ||||
| export LC_ALL=en_US.UTF-8 | ||||
| export PKG_URL=$1 | ||||
|  | ||||
| # Upgrade | ||||
| pacman -Suy --noconfirm | ||||
|  | ||||
| # Workdir | ||||
| chown builder:builder /buildroot | ||||
| cd /buildroot | ||||
|  | ||||
| # Build the damn thing | ||||
| sudo -u builder git clone "$PKG_URL" . | ||||
| sudo -u builder makepkg -s --noconfirm -L | ||||
							
								
								
									
										29
									
								
								makepkg-docker
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										29
									
								
								makepkg-docker
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| #!/usr/bin/env bash | ||||
| shopt -s nullglob | ||||
|  | ||||
| did="pkg-build-$$.$SRANDOM" | ||||
|  | ||||
| pkg_dest=$1 | ||||
| pkg_url=$2 | ||||
|  | ||||
| cd /home/docker/dockerfiles/builder | ||||
| docker build -t "$did" --build-arg --force-rm . | ||||
| docker run --rm -v "/tmp/$did:/buildroot" "$did:latest" /build "$pkg_url" | ||||
|  | ||||
| artifacts=( "/tmp/$did/"*.pkg.* ) | ||||
| for i in "${artifacts[@]}"; do | ||||
| 	i_name="${i##*/}" | ||||
|  | ||||
| 	printf 'Found artifact: %s\n' "$i_name" | ||||
| 		 | ||||
| 	if [[ -f "$pkg_dest/$i_name" ]]; then | ||||
| 		printf '%s/%s already exists, not overwriting.\n' "$pkg_dest" "$i_name" | ||||
| 	else | ||||
| 		printf 'Copying %s to %s.\n' "$i_name" "$pkg_dest" | ||||
| 		cp -vn "$i" "$pkg_dest" | ||||
| 	fi | ||||
| done | ||||
|  | ||||
| # cleanup | ||||
| docker rmi "$did" | ||||
| rm -rf "/tmp/$did" | ||||
		Reference in New Issue
	
	Block a user