Merged Dockerfiles (#282)
* Dockerfile re-imagined to handle all flavors in one script.
This commit is contained in:
parent
41a5d1bf2c
commit
d00cf7de92
6 changed files with 130 additions and 103 deletions
98
docker-build.sh
Normal file
98
docker-build.sh
Normal file
|
@ -0,0 +1,98 @@
|
|||
#! /bin/bash
|
||||
set -e
|
||||
|
||||
outputFolder='_output'
|
||||
|
||||
ProgressStart()
|
||||
{
|
||||
echo "Start '$1'"
|
||||
}
|
||||
|
||||
ProgressEnd()
|
||||
{
|
||||
echo "Finish '$1'"
|
||||
}
|
||||
|
||||
Build()
|
||||
{
|
||||
local RID="$1"
|
||||
|
||||
ProgressStart 'Build for $RID'
|
||||
|
||||
slnFile=Kavita.sln
|
||||
|
||||
dotnet clean $slnFile -c Debug
|
||||
dotnet clean $slnFile -c Release
|
||||
|
||||
dotnet msbuild -restore $slnFile -p:Configuration=Release -p:Platform="Any CPU" -p:RuntimeIdentifiers=$RID
|
||||
|
||||
ProgressEnd 'Build for $RID'
|
||||
}
|
||||
|
||||
BuildUI()
|
||||
{
|
||||
ProgressStart 'Building UI'
|
||||
cd ../Kavita-webui/ || exit
|
||||
npm install
|
||||
npm run prod
|
||||
cd ../Kavita/ || exit
|
||||
ProgressEnd 'Building UI'
|
||||
}
|
||||
|
||||
Package()
|
||||
{
|
||||
local framework="$1"
|
||||
local runtime="$2"
|
||||
local lOutputFolder=../_output/"$runtime"/Kavita
|
||||
|
||||
ProgressStart "Creating $runtime Package for $framework"
|
||||
|
||||
# TODO: Use no-restore? Because Build should have already done it for us
|
||||
echo "Building"
|
||||
cd API
|
||||
echo dotnet publish -c Release --no-restore --self-contained --runtime $runtime -o "$lOutputFolder" --framework $framework
|
||||
dotnet publish -c Release --no-restore --self-contained --runtime $runtime -o "$lOutputFolder" --framework $framework
|
||||
|
||||
echo "Copying Install information"
|
||||
cp ../INSTALL.txt "$lOutputFolder"/README.txt
|
||||
|
||||
echo "Copying LICENSE"
|
||||
cp ../LICENSE "$lOutputFolder"/LICENSE.txt
|
||||
|
||||
echo "Renaming API -> Kavita"
|
||||
mv "$lOutputFolder"/API "$lOutputFolder"/Kavita
|
||||
|
||||
echo "Creating tar"
|
||||
cd ../$outputFolder/"$runtime"/
|
||||
tar -czvf ../kavita-$runtime.tar.gz Kavita
|
||||
|
||||
ProgressEnd "Creating $runtime Package for $framework"
|
||||
|
||||
}
|
||||
|
||||
dir=$PWD
|
||||
|
||||
if [ -d _output ]
|
||||
then
|
||||
rm -r _output/
|
||||
fi
|
||||
|
||||
BuildUI
|
||||
|
||||
#Build for x64
|
||||
Build "linux-x64"
|
||||
Package "net5.0" "linux-x64"
|
||||
cd "$dir"
|
||||
|
||||
#Build for arm
|
||||
Build "linux-arm"
|
||||
Package "net5.0" "linux-arm"
|
||||
cd "$dir"
|
||||
|
||||
#Build for arm64
|
||||
Build "linux-arm64"
|
||||
Package "net5.0" "linux-arm64"
|
||||
cd "$dir"
|
||||
|
||||
#Builds Docker images
|
||||
docker buildx build -t kizaing/kavita:nightly --platform linux/amd64,linux/arm/v7,linux/arm64 . --push
|
Loading…
Add table
Add a link
Reference in a new issue