mirror of
https://github.com/jakeswenson/BitBetter.git
synced 2025-12-16 19:26:18 +00:00
Build image from source (#234)
* Build image from source
* Clone only current version tag
* remove obsolete project
* support loading Core.dll from single file application
* pass single file application to license gen
* remove loose file parameter
* fix executable parameter
* Remove unnecessary changes in LicensingService.cs
* Revert "Remove unnecessary changes in LicensingService.cs"
This reverts commit d8465e1aec.
* Changed comment
This commit is contained in:
18
build.sh
18
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,18 @@ 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 server repository
|
||||
rm -rf $DIR/server
|
||||
git clone --branch "v${BW_VERSION}" --depth 1 https://github.com/bitwarden/server.git $DIR/server
|
||||
|
||||
cp "$DIR/.keys/cert.cert" "$DIR/src/bitBetter/.keys"
|
||||
# Replace certificate file and thumbprint
|
||||
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 ':')
|
||||
sed -i -e "s/$old_thumbprint/$new_thumbprint/g" $DIR/server/src/Core/Services/Implementations/LicensingService.cs
|
||||
cp $DIR/.keys/cert.cert $DIR/server/src/Core/licensing.cer
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user