From bf100dcf244c991c4dfa0b730c0a1a0774bf8b12 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 31 Dec 2020 14:36:56 -0600 Subject: update build scripts and dockerfile --- Dockerfile | 2 +- bin/build | 34 +++++++++++++++++++++++++--------- bin/publish | 10 +++++----- bin/run | 2 +- bin/start | 5 ++--- 5 files changed, 34 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index e84b35a4..4bd3dbca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM mcr.microsoft.com/dotnet/aspnet:5.0 -COPY api/bin/Release/net5.0/publish app/ +COPY slskd/bin/Release/net5.0/publish app/ RUN mkdir /var/slsk RUN mkdir /var/slsk/shared diff --git a/bin/build b/bin/build index 8b3470ad..17119554 100644 --- a/bin/build +++ b/bin/build @@ -2,25 +2,41 @@ set -e # build web -cd web +cd src/web + +echo $'\n> pwd\n' pwd +echo $'\n> npm install\n' npm install +echo $'\n> npm run build\n' npm run build # remove old build, but keep .gitkeep -rm -rf ../api/wwwroot -mkdir ../api/wwwroot -touch ../api/wwwroot/.gitkeep +rm -rf ../slskd/wwwroot +mkdir ../slskd/wwwroot +touch ../slskd/wwwroot/.gitkeep # copy new files -cp -r build/* ../api/wwwroot/ +echo $'\n> cp -r build/* ../slskd/wwwroot/\n' +cp -r build/* ../slskd/wwwroot/ # publish api + web -cd ../api +cd ../slskd +echo $'\n> pwd\n' pwd +echo $'\n> dotnet publish --configuration Release\n' dotnet publish --configuration Release # build docker -cd .. -pwd -docker build -t jpdillingham/slsk-web-example:latest . \ No newline at end of file +if [ "$1" == "--with-docker" ]; then + tag=$(git log -1 --pretty=%H) + cd ../.. + echo $'\n> pwd\n' + pwd + echo $'\n> docker build -t slskd/slskd:'$tag$' .\n' + docker build -t slskd/slskd:$tag . + echo $'\n> docker tag slsk/slskd:'$tag$' slskd/sldkd:latest\n' + docker tag slsk/slskd:$tag slskd/slskd:latest +fi + +echo build succeded. \ No newline at end of file diff --git a/bin/publish b/bin/publish index c2e2faf6..03f51b21 100644 --- a/bin/publish +++ b/bin/publish @@ -1,10 +1,10 @@ #!/bin/bash set -e -cd api +cd src/slskd pwd -dotnet publish --configuration Release --self-contained --runtime win-x64 -dotnet publish --configuration Release --self-contained --runtime linux-x64 -dotnet publish --configuration Release --self-contained --runtime linux-arm -dotnet publish --configuration Release --self-contained --runtime osx-x64 \ No newline at end of file +dotnet publish --configuration Release -p:PublishSingleFile=true -p:ReadyToRun=true -p:PublishTrimmed=true -p:IncludeNativeLibrariesForSelfExtract=true --self-contained --runtime win-x64 +dotnet publish --configuration Release -p:PublishSingleFile=true -p:ReadyToRun=true -p:PublishTrimmed=true -p:IncludeNativeLibrariesForSelfExtract=true --self-contained --runtime linux-x64 +dotnet publish --configuration Release -p:PublishSingleFile=true -p:ReadyToRun=true -p:PublishTrimmed=true -p:IncludeNativeLibrariesForSelfExtract=true --self-contained --runtime linux-arm +dotnet publish --configuration Release -p:PublishSingleFile=true -p:ReadyToRun=true -p:PublishTrimmed=true -p:IncludeNativeLibrariesForSelfExtract=true --self-contained --runtime osx-x64 \ No newline at end of file diff --git a/bin/run b/bin/run index 24d81890..b326f75b 100644 --- a/bin/run +++ b/bin/run @@ -11,4 +11,4 @@ docker run -i \ -e "SLSK_DIAGNOSTIC=Info" \ -e "SLSK_CONNECT_TIMEOUT=5000" \ -e "SLSK_INACTIVITY_TIMEOUT=15000" \ - jpdillingham/slsk-web-example:latest \ No newline at end of file + slskd/slskd:latest \ No newline at end of file diff --git a/bin/start b/bin/start index 949fa365..045c02b6 100644 --- a/bin/start +++ b/bin/start @@ -11,6 +11,5 @@ docker run -d \ -e "SLSK_DIAGNOSTIC=Info" \ -e "SLSK_CONNECT_TIMEOUT=5000" \ -e "SLSK_INACTIVITY_TIMEOUT=15000" \ - --name soulseek \ - --restart always \ - jpdillingham/slsk-web-example:latest \ No newline at end of file + --name slskd \ + slskd/slskd:latest \ No newline at end of file -- cgit v1.2.3