mirror of
				https://github.com/jakeswenson/BitBetter.git
				synced 2025-10-31 04:43: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 | ||||
| } | ||||
| 
 | ||||
| if (Test-Path -Path "$pwd\licenseGen\Core.dll" -PathType Leaf) { | ||||
| 	Remove-Item "$pwd\licenseGen\Core.dll" -Force | ||||
| if (Test-Path -Path "$pwd\src\licenseGen\Core.dll" -PathType Leaf) { | ||||
| 	Remove-Item "$pwd\src\licenseGen\Core.dll" -Force | ||||
| } | ||||
| 
 | ||||
| if (Test-Path -Path "$pwd\licenseGen\cert.pfx" -PathType Leaf) { | ||||
| 	Remove-Item "$pwd\licenseGen\cert.pfx" -Force | ||||
| if (Test-Path -Path "$pwd\src\licenseGen\cert.pfx" -PathType Leaf) { | ||||
| 	Remove-Item "$pwd\src\licenseGen\cert.pfx" -Force | ||||
| } | ||||
| 
 | ||||
| if (Test-Path -Path "$pwd\bitBetter\cert.cert" -PathType Leaf) { | ||||
| 	Remove-Item "$pwd\bitBetter\cert.cert" -Force | ||||
| if (Test-Path -Path "$pwd\src\bitBetter\cert.cert" -PathType Leaf) { | ||||
| 	Remove-Item "$pwd\src\bitBetter\cert.cert" -Force | ||||
| } | ||||
| 
 | ||||
| # generate keys if none are available | ||||
|  | @ -26,12 +26,12 @@ if (!(Test-Path "$pwd\.keys")) { | |||
| } | ||||
| 
 | ||||
| # copy the key to bitBetter and licenseGen | ||||
| Copy-Item "$pwd\.keys\cert.cert" -Destination "$pwd\bitBetter" | ||||
| Copy-Item "$pwd\.keys\cert.pfx" -Destination "$pwd\licenseGen" | ||||
| Copy-Item "$pwd\.keys\cert.cert" -Destination "$pwd\src\bitBetter" | ||||
| Copy-Item "$pwd\.keys\cert.pfx" -Destination "$pwd\src\licenseGen" | ||||
| 
 | ||||
| # build bitBetter and clean the source directory after | ||||
| docker build -t bitbetter/bitbetter "$pwd\bitBetter" | ||||
| Remove-Item "$pwd\bitBetter\cert.cert" -Force | ||||
| docker build -t bitbetter/bitbetter "$pwd\src\bitBetter" | ||||
| Remove-Item "$pwd\src\bitBetter\cert.cert" -Force | ||||
| 
 | ||||
| # gather all running instances | ||||
| $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 | ||||
| docker run -v "$tempdirectory`:/app/mount" --rm bitbetter/bitbetter | ||||
| 
 | ||||
| # copy the patched files back into the temporary instance | ||||
| foreach ($component in $components) { | ||||
| 	docker cp "$tempdirectory\$component\Core.dll" $patchinstance`:/app/$component/Core.dll | ||||
| } | ||||
| 
 | ||||
| # create a new image from our patched instanced | ||||
| docker commit $patchinstance bitwarden-patch | ||||
| # create a new image with the patched files | ||||
| docker build . --tag bitwarden-patch --file "$pwd\src\bitBetter\Dockerfile-bitwarden-patch" | ||||
| 
 | ||||
| # stop and remove our temporary container | ||||
| docker stop bitwarden-patch | ||||
| docker rm bitwarden-patch | ||||
| 
 | ||||
| # 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-Item "$tempdirectory" -Recurse -Force | ||||
|  | @ -102,8 +97,8 @@ foreach($line in Get-Content "$pwd\.servers\serverlist.txt") { | |||
| docker image rm bitbetter/bitbetter | ||||
| 
 | ||||
| # build the licenseGen | ||||
| docker build -t bitbetter/licensegen "$pwd\licenseGen" | ||||
| docker build -t bitbetter/licensegen "$pwd\src\licenseGen" | ||||
| 
 | ||||
| # clean the licenseGen source directory | ||||
| Remove-Item "$pwd\licenseGen\Core.dll" -Force | ||||
| Remove-Item "$pwd\licenseGen\cert.pfx" -Force | ||||
| Remove-Item "$pwd\src\licenseGen\Core.dll" -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" | ||||
| fi | ||||
| 
 | ||||
| if [ -f "$PWD/licenseGen/Core.dll" ]; then | ||||
|     rm -f "$PWD/licenseGen/Core.dll" | ||||
| if [ -f "$PWD/src/licenseGen/Core.dll" ]; then | ||||
|     rm -f "$PWD/src/licenseGen/Core.dll" | ||||
| fi | ||||
| 
 | ||||
| if [ -f "$PWD/licenseGen/cert.pfx" ]; then | ||||
|     rm -f "$PWD/licenseGen/cert.pfx" | ||||
| if [ -f "$PWD/src/licenseGen/cert.pfx" ]; then | ||||
|     rm -f "$PWD/src/licenseGen/cert.pfx" | ||||
| fi | ||||
| 
 | ||||
| if [ -f "$PWD/bitBetter/cert.cert" ]; then | ||||
|     rm -f "$PWD/bitBetter/cert.cert" | ||||
| if [ -f "$PWD/src/bitBetter/cert.cert" ]; then | ||||
|     rm -f "$PWD/src/bitBetter/cert.cert" | ||||
| fi | ||||
| 
 | ||||
| # generate keys if none are available | ||||
|  | @ -29,12 +29,12 @@ if [ ! -d "$PWD/.keys" ]; then | |||
| fi | ||||
| 
 | ||||
| # copy the key to bitBetter and licenseGen | ||||
| cp -f "$PWD/.keys/cert.cert" "$PWD/bitBetter" | ||||
| cp -f "$PWD/.keys/cert.pfx" "$PWD/licenseGen" | ||||
| cp -f "$PWD/.keys/cert.cert" "$PWD/src/bitBetter" | ||||
| cp -f "$PWD/.keys/cert.pfx" "$PWD/src/licenseGen" | ||||
| 
 | ||||
| # build bitBetter and clean the source directory after | ||||
| docker build -t bitbetter/bitbetter "$PWD/bitBetter" | ||||
| rm -f "$PWD/bitBetter/cert.cert" | ||||
| docker build -t bitbetter/bitbetter "$PWD/src/bitBetter" | ||||
| rm -f "$PWD/src/bitBetter/cert.cert" | ||||
| 
 | ||||
| # gather all running instances | ||||
| 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 | ||||
| docker run -v "$TEMPDIRECTORY:/app/mount" --rm bitbetter/bitbetter | ||||
| 
 | ||||
| # copy the patched files back into the temporary instance | ||||
| for COMPONENT in ${COMPONENTS[@]}; do | ||||
| 	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 | ||||
| # create a new image with the patched files | ||||
| docker build . --tag bitwarden-patch --file "$PWD/src/bitBetter/Dockerfile-bitwarden-patch" | ||||
| 
 | ||||
| # stop and remove our temporary container | ||||
| docker stop bitwarden-patch | ||||
| docker rm bitwarden-patch | ||||
| 
 | ||||
| # 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 | ||||
| rm -rf "$TEMPDIRECTORY" | ||||
|  | @ -104,8 +99,8 @@ done | |||
| docker image rm bitbetter/bitbetter | ||||
| 
 | ||||
| # build the licenseGen | ||||
| docker build -t bitbetter/licensegen "$PWD/licenseGen" | ||||
| docker build -t bitbetter/licensegen "$PWD/src/licenseGen" | ||||
| 
 | ||||
| # clean the licenseGen source directory | ||||
| rm -f "$PWD/licenseGen/Core.dll" | ||||
| rm -f "$PWD/licenseGen/cert.pfx" | ||||
| rm -f "$PWD/src/licenseGen/Core.dll" | ||||
| 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