Skip to content

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.

Feature/docker setup (#294)

Kizaing560b0c9cb580
diff --git a/.github/workflows/nightly-docker.yml b/.github/workflows/nightly-docker.yml
index c42f0a5eb..284a1cb68 100644
--- a/.github/workflows/nightly-docker.yml
+++ b/.github/workflows/nightly-docker.yml
@@ -13,12 +13,39 @@ jobs:
- name: Check Out Repo
uses: actions/checkout@v2
+ - name: Check Out WebUI
+ uses: actions/checkout@v2
+ with:
+ repository: Kareadita/Kavita-webui
+ ref: feature/sentry-release
+ path: Kavita-webui/
+
+ - name: NodeJS to Compile WebUI
+ uses: actions/[email protected]
+ with:
+ node-version: '14'
+ - run: |
+ cd Kavita-webui/ || exit
+ npm install
+ npm run prod
+ mv dist/ ../API/wwwroot
+ cd ../ || exit
+
+ - name: Compile dotnet app
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: '5.0.x'
+ - run: ./action-build.sh
+
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v1
+
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
@@ -27,10 +54,10 @@ jobs:
id: docker_build
uses: docker/build-push-action@v2
with:
- context: ./
- file: ./Dockerfile
+ context: .
+ platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
- tags: kizaing/kavita:nightly-amd64
+ tags: kizaing/kavita:nightly
- name: Image digest
- run: echo ${{ steps.docker_build.outputs.digest }}
\ No newline at end of file
+ run: echo ${{ steps.docker_build.outputs.digest }}
diff --git a/action-build.sh b/action-build.sh
new file mode 100755
index 000000000..559765710
--- /dev/null
+++ b/action-build.sh
@@ -0,0 +1,83 @@
+#! /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"
+}
+
+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
+
+#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"
\ No newline at end of file
diff --git a/copy_runtime.sh b/copy_runtime.sh
old mode 100644
new mode 100755
diff --git a/docker-build.sh b/docker-build.sh
index 05b05dda4..c97478910 100644
--- a/docker-build.sh
+++ b/docker-build.sh
@@ -15,7 +15,7 @@ ProgressEnd()
Build()
{
- local RID="$1"
+ local RID="$1"
ProgressStart 'Build for $RID'
@@ -24,8 +24,8 @@ Build()
dotnet clean $slnFile -c Debug
dotnet clean $slnFile -c Release
- dotnet msbuild -restore $slnFile -p:Configuration=Release -p:Platform="Any CPU" -p:RuntimeIdentifiers=$RID
-
+ dotnet msbuild -restore $slnFile -p:Configuration=Release -p:Platform="Any CPU" -p:RuntimeIdentifiers=$RID
+
ProgressEnd 'Build for $RID'
}