mirror of
				https://github.com/jakeswenson/BitBetter.git
				synced 2025-10-31 12:53:25 +00:00 
			
		
		
		
	Move to src folder and improve image creation
This commit is contained in:
		
							parent
							
								
									2d1f607a9d
								
							
						
					
					
						commit
						528c9b0ec1
					
				
							
								
								
									
										37
									
								
								build.ps1
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								build.ps1
									
									
									
									
									
								
							|  | @ -8,16 +8,16 @@ if (Test-Path "$tempdirectory") { | ||||||
| 	Remove-Item "$tempdirectory" -Recurse -Force | 	Remove-Item "$tempdirectory" -Recurse -Force | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| if (Test-Path -Path "$pwd\licenseGen\Core.dll" -PathType Leaf) { | if (Test-Path -Path "$pwd\src\licenseGen\Core.dll" -PathType Leaf) { | ||||||
| 	Remove-Item "$pwd\licenseGen\Core.dll" -Force | 	Remove-Item "$pwd\src\licenseGen\Core.dll" -Force | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| if (Test-Path -Path "$pwd\licenseGen\cert.pfx" -PathType Leaf) { | if (Test-Path -Path "$pwd\src\licenseGen\cert.pfx" -PathType Leaf) { | ||||||
| 	Remove-Item "$pwd\licenseGen\cert.pfx" -Force | 	Remove-Item "$pwd\src\licenseGen\cert.pfx" -Force | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| if (Test-Path -Path "$pwd\bitBetter\cert.cert" -PathType Leaf) { | if (Test-Path -Path "$pwd\src\bitBetter\cert.cert" -PathType Leaf) { | ||||||
| 	Remove-Item "$pwd\bitBetter\cert.cert" -Force | 	Remove-Item "$pwd\src\bitBetter\cert.cert" -Force | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| # generate keys if none are available | # generate keys if none are available | ||||||
|  | @ -26,12 +26,12 @@ if (!(Test-Path "$pwd\.keys")) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| # copy the key to bitBetter and licenseGen | # copy the key to bitBetter and licenseGen | ||||||
| Copy-Item "$pwd\.keys\cert.cert" -Destination "$pwd\bitBetter" | Copy-Item "$pwd\.keys\cert.cert" -Destination "$pwd\src\bitBetter" | ||||||
| Copy-Item "$pwd\.keys\cert.pfx" -Destination "$pwd\licenseGen" | Copy-Item "$pwd\.keys\cert.pfx" -Destination "$pwd\src\licenseGen" | ||||||
| 
 | 
 | ||||||
| # build bitBetter and clean the source directory after | # build bitBetter and clean the source directory after | ||||||
| docker build -t bitbetter/bitbetter "$pwd\bitBetter" | docker build -t bitbetter/bitbetter "$pwd\src\bitBetter" | ||||||
| Remove-Item "$pwd\bitBetter\cert.cert" -Force | Remove-Item "$pwd\src\bitBetter\cert.cert" -Force | ||||||
| 
 | 
 | ||||||
| # gather all running instances | # gather all running instances | ||||||
| $oldinstances = docker container ps --all -f Name=bitwarden --format '{{.ID}}' | $oldinstances = docker container ps --all -f Name=bitwarden --format '{{.ID}}' | ||||||
|  | @ -75,20 +75,15 @@ foreach ($component in $components) { | ||||||
| # run bitBetter, this applies our patches to the required files | # run bitBetter, this applies our patches to the required files | ||||||
| docker run -v "$tempdirectory`:/app/mount" --rm bitbetter/bitbetter | docker run -v "$tempdirectory`:/app/mount" --rm bitbetter/bitbetter | ||||||
| 
 | 
 | ||||||
| # copy the patched files back into the temporary instance | # create a new image with the patched files | ||||||
| foreach ($component in $components) { | docker build . --tag bitwarden-patch --file "$pwd\src\bitBetter\Dockerfile-bitwarden-patch" | ||||||
| 	docker cp "$tempdirectory\$component\Core.dll" $patchinstance`:/app/$component/Core.dll |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| # create a new image from our patched instanced |  | ||||||
| docker commit $patchinstance bitwarden-patch |  | ||||||
| 
 | 
 | ||||||
| # stop and remove our temporary container | # stop and remove our temporary container | ||||||
| docker stop bitwarden-patch | docker stop bitwarden-patch | ||||||
| docker rm bitwarden-patch | docker rm bitwarden-patch | ||||||
| 
 | 
 | ||||||
| # copy our patched library to the licenseGen source directory | # copy our patched library to the licenseGen source directory | ||||||
| Copy-Item "$tempdirectory\Identity\Core.dll" -Destination "$pwd\licenseGen" | Copy-Item "$tempdirectory\Identity\Core.dll" -Destination "$pwd\src\licenseGen" | ||||||
| 
 | 
 | ||||||
| # remove our temporary directory | # remove our temporary directory | ||||||
| Remove-Item "$tempdirectory" -Recurse -Force | Remove-Item "$tempdirectory" -Recurse -Force | ||||||
|  | @ -102,8 +97,8 @@ foreach($line in Get-Content "$pwd\.servers\serverlist.txt") { | ||||||
| docker image rm bitbetter/bitbetter | docker image rm bitbetter/bitbetter | ||||||
| 
 | 
 | ||||||
| # build the licenseGen | # build the licenseGen | ||||||
| docker build -t bitbetter/licensegen "$pwd\licenseGen" | docker build -t bitbetter/licensegen "$pwd\src\licenseGen" | ||||||
| 
 | 
 | ||||||
| # clean the licenseGen source directory | # clean the licenseGen source directory | ||||||
| Remove-Item "$pwd\licenseGen\Core.dll" -Force | Remove-Item "$pwd\src\licenseGen\Core.dll" -Force | ||||||
| Remove-Item "$pwd\licenseGen\cert.pfx" -Force | Remove-Item "$pwd\src\licenseGen\cert.pfx" -Force | ||||||
							
								
								
									
										37
									
								
								build.sh
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								build.sh
									
									
									
									
									
								
							|  | @ -11,16 +11,16 @@ if [ -d "$TEMPDIRECTORY" ]; then | ||||||
| 	rm -rf "$TEMPDIRECTORY" | 	rm -rf "$TEMPDIRECTORY" | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| if [ -f "$PWD/licenseGen/Core.dll" ]; then | if [ -f "$PWD/src/licenseGen/Core.dll" ]; then | ||||||
|     rm -f "$PWD/licenseGen/Core.dll" |     rm -f "$PWD/src/licenseGen/Core.dll" | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| if [ -f "$PWD/licenseGen/cert.pfx" ]; then | if [ -f "$PWD/src/licenseGen/cert.pfx" ]; then | ||||||
|     rm -f "$PWD/licenseGen/cert.pfx" |     rm -f "$PWD/src/licenseGen/cert.pfx" | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| if [ -f "$PWD/bitBetter/cert.cert" ]; then | if [ -f "$PWD/src/bitBetter/cert.cert" ]; then | ||||||
|     rm -f "$PWD/bitBetter/cert.cert" |     rm -f "$PWD/src/bitBetter/cert.cert" | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| # generate keys if none are available | # generate keys if none are available | ||||||
|  | @ -29,12 +29,12 @@ if [ ! -d "$PWD/.keys" ]; then | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| # copy the key to bitBetter and licenseGen | # copy the key to bitBetter and licenseGen | ||||||
| cp -f "$PWD/.keys/cert.cert" "$PWD/bitBetter" | cp -f "$PWD/.keys/cert.cert" "$PWD/src/bitBetter" | ||||||
| cp -f "$PWD/.keys/cert.pfx" "$PWD/licenseGen" | cp -f "$PWD/.keys/cert.pfx" "$PWD/src/licenseGen" | ||||||
| 
 | 
 | ||||||
| # build bitBetter and clean the source directory after | # build bitBetter and clean the source directory after | ||||||
| docker build -t bitbetter/bitbetter "$PWD/bitBetter" | docker build -t bitbetter/bitbetter "$PWD/src/bitBetter" | ||||||
| rm -f "$PWD/bitBetter/cert.cert" | rm -f "$PWD/src/bitBetter/cert.cert" | ||||||
| 
 | 
 | ||||||
| # gather all running instances | # gather all running instances | ||||||
| OLDINSTANCES=$(docker container ps --all -f Name=bitwarden --format '{{.ID}}') | OLDINSTANCES=$(docker container ps --all -f Name=bitwarden --format '{{.ID}}') | ||||||
|  | @ -77,20 +77,15 @@ done | ||||||
| # run bitBetter, this applies our patches to the required files | # run bitBetter, this applies our patches to the required files | ||||||
| docker run -v "$TEMPDIRECTORY:/app/mount" --rm bitbetter/bitbetter | docker run -v "$TEMPDIRECTORY:/app/mount" --rm bitbetter/bitbetter | ||||||
| 
 | 
 | ||||||
| # copy the patched files back into the temporary instance | # create a new image with the patched files | ||||||
| for COMPONENT in ${COMPONENTS[@]}; do | docker build . --tag bitwarden-patch --file "$PWD/src/bitBetter/Dockerfile-bitwarden-patch" | ||||||
| 	docker cp "$TEMPDIRECTORY/$COMPONENT/Core.dll" $PATCHINSTANCE:/app/$COMPONENT/Core.dll |  | ||||||
| done |  | ||||||
| 
 |  | ||||||
| # create a new image from our patched instanced |  | ||||||
| docker commit $PATCHINSTANCE bitwarden-patch |  | ||||||
| 
 | 
 | ||||||
| # stop and remove our temporary container | # stop and remove our temporary container | ||||||
| docker stop bitwarden-patch | docker stop bitwarden-patch | ||||||
| docker rm bitwarden-patch | docker rm bitwarden-patch | ||||||
| 
 | 
 | ||||||
| # copy our patched library to the licenseGen source directory | # copy our patched library to the licenseGen source directory | ||||||
| cp -f "$TEMPDIRECTORY/Identity/Core.dll" "$PWD/licenseGen" | cp -f "$TEMPDIRECTORY/Identity/Core.dll" "$PWD/src/licenseGen" | ||||||
| 
 | 
 | ||||||
| # remove our temporary directory | # remove our temporary directory | ||||||
| rm -rf "$TEMPDIRECTORY" | rm -rf "$TEMPDIRECTORY" | ||||||
|  | @ -104,8 +99,8 @@ done | ||||||
| docker image rm bitbetter/bitbetter | docker image rm bitbetter/bitbetter | ||||||
| 
 | 
 | ||||||
| # build the licenseGen | # build the licenseGen | ||||||
| docker build -t bitbetter/licensegen "$PWD/licenseGen" | docker build -t bitbetter/licensegen "$PWD/src/licenseGen" | ||||||
| 
 | 
 | ||||||
| # clean the licenseGen source directory | # clean the licenseGen source directory | ||||||
| rm -f "$PWD/licenseGen/Core.dll" | rm -f "$PWD/src/licenseGen/Core.dll" | ||||||
| rm -f "$PWD/licenseGen/cert.pfx" | rm -f "$PWD/src/licenseGen/cert.pfx" | ||||||
							
								
								
									
										4
									
								
								src/bitBetter/Dockerfile-bitwarden-patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								src/bitBetter/Dockerfile-bitwarden-patch
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,4 @@ | ||||||
|  | FROM bitwarden/self-host:beta | ||||||
|  | 
 | ||||||
|  | COPY ./temp/Api/Core.dll /app/Api/Core.dll | ||||||
|  | COPY ./temp/Identity/Core.dll /app/Identity/Core.dll | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user