mirror of
				https://github.com/jakeswenson/BitBetter.git
				synced 2025-10-31 12:53:25 +00:00 
			
		
		
		
	Build image from source
This commit is contained in:
		
							parent
							
								
									676dd7b85c
								
							
						
					
					
						commit
						1a2073cf35
					
				
							
								
								
									
										22
									
								
								build.sh
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								build.sh
									
									
									
									
									
								
							|  | @ -1,5 +1,5 @@ | |||
| #!/bin/sh | ||||
| 
 | ||||
| set -e | ||||
| DIR=`dirname "$0"` | ||||
| DIR=`exec 2>/dev/null;(cd -- "$DIR") && cd -- "$DIR"|| cd "$DIR"; unset PWD; /usr/bin/pwd || /bin/pwd || pwd` | ||||
| BW_VERSION=$(curl -sL https://go.btwrdn.co/bw-sh-versions | grep '^ *"'coreVersion'":' | awk -F\: '{ print $2 }' | sed -e 's/,$//' -e 's/^"//' -e 's/"$//') | ||||
|  | @ -9,14 +9,20 @@ echo "Building BitBetter for BitWarden version $BW_VERSION" | |||
| # If there aren't any keys, generate them first. | ||||
| [ -e "$DIR/.keys/cert.cert" ] || "$DIR/.keys/generate-keys.sh" | ||||
| 
 | ||||
| [ -e "$DIR/src/bitBetter/.keys" ] || mkdir "$DIR/src/bitBetter/.keys" | ||||
| # Prepare Bitwarden repository | ||||
| rm -rf $DIR/server | ||||
| git clone https://github.com/bitwarden/server.git | ||||
| git -C $DIR/server checkout tags/v${BW_VERSION} | ||||
| old_thumbprint=$(openssl x509 -fingerprint -noout -in $DIR/server/src/Core/licensing.cer | cut -d= -f2 | tr -d ':') | ||||
| new_thumbprint=$(openssl x509 -fingerprint -noout -in $DIR/.keys/cert.cert | cut -d= -f2 | tr -d ':') | ||||
| cp $DIR/.keys/cert.cert $DIR/server/src/Core/licensing.cer | ||||
| # Optional, has actually no effect | ||||
| sed -i -e "s/$old_thumbprint/$new_thumbprint/g" $DIR/server/src/Core/Services/Implementations/LicensingService.cs | ||||
| # Enable loose files for API, so Core.dll is accessible | ||||
| sed -i -e 's/PublishSingleFile=true/PublishSingleFile=false/g' $DIR/server/src/Api/Dockerfile | ||||
| 
 | ||||
| cp "$DIR/.keys/cert.cert" "$DIR/src/bitBetter/.keys" | ||||
| 
 | ||||
| docker run --rm -v "$DIR/src/bitBetter:/bitBetter" -w=/bitBetter mcr.microsoft.com/dotnet/sdk:8.0 sh build.sh | ||||
| 
 | ||||
| docker build --no-cache --build-arg BITWARDEN_TAG=ghcr.io/bitwarden/api:$BW_VERSION --label com.bitwarden.product="bitbetter" -t bitbetter/api "$DIR/src/bitBetter" # --squash | ||||
| docker build --no-cache --build-arg BITWARDEN_TAG=ghcr.io/bitwarden/identity:$BW_VERSION --label com.bitwarden.product="bitbetter" -t bitbetter/identity "$DIR/src/bitBetter" # --squash | ||||
| docker build --no-cache --label com.bitwarden.product="bitbetter" $DIR/server -f $DIR/server/src/Api/Dockerfile -t bitbetter/api | ||||
| docker build --no-cache --label com.bitwarden.product="bitbetter" $DIR/server -f $DIR/server/src/Identity/Dockerfile -t bitbetter/identity | ||||
| 
 | ||||
| docker tag bitbetter/api bitbetter/api:latest | ||||
| docker tag bitbetter/identity bitbetter/identity:latest | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user