aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-01-02 12:49:22 -0600
committerJP Dillingham <jpdillingham@gmail.com>2021-01-02 12:49:22 -0600
commit7b6ba4191c5acdb4d762ec7142adfe9d7943ab95 (patch)
tree305f5f06a62cac9c470d3dcb4856ceab6a0ad6eb
parentffe371cd5275f0b075ca7a00ec14cd330d0e3ee1 (diff)
downloadslskd-7b6ba4191c5acdb4d762ec7142adfe9d7943ab95.tar.gz
tweak build stuff
-rw-r--r--.dockerignore8
-rw-r--r--Dockerfile15
-rwxr-xr-xbin/build17
-rwxr-xr-xbin/start15
-rw-r--r--src/web/package.json1
5 files changed, 24 insertions, 32 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..d5fba940
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,8 @@
+src/web/build
+src/web/node_modules
+src/web/.eslintcache
+src/web/.gitignore
+
+src/slskd/bin
+src/slskd/obj
+src/slskd/.gitignore \ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index b910103e..6b621ad3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,18 +1,27 @@
FROM node:lts-alpine3.12 AS web
WORKDIR /web/
COPY src/web .
-RUN npm install
+RUN npm ci
+RUN npm run test-unattended
RUN npm run build
FROM mcr.microsoft.com/dotnet/sdk:5.0 as build
WORKDIR /slskd/
COPY src/slskd .
COPY --from=web web/build wwwroot
-RUN dotnet publish --configuration Release -p:PublishSingleFile=true -p:ReadyToRun=true -p:PublishTrimmed=true -p:IncludeNativeLibrariesForSelfExtract=true --self-contained --runtime linux-musl-x64
+RUN dotnet restore
+RUN dotnet build --no-restore --configuration Release
+RUN dotnet test --no-build --verbosity minimal --blame
+
+FROM mcr.microsoft.com/dotnet/sdk:5.0 as publish
+WORKDIR /slskd/
+COPY src/slskd .
+COPY --from=web web/build wwwroot
+RUN dotnet publish --configuration Release -p:PublishSingleFile=true -p:ReadyToRun=true -p:PublishTrimmed=true -p:IncludeNativeLibrariesForSelfExtract=true -p:CopyOutputSymbolsToPublishDirectory=false --self-contained --runtime linux-musl-x64 --output dist
FROM mcr.microsoft.com/dotnet/runtime-deps:5.0-alpine
WORKDIR /slskd/
-COPY --from=build slskd/bin/Release/net5.0/linux-musl-x64/publish .
+COPY --from=publish slskd/dist .
RUN mkdir /var/slsk
RUN mkdir /var/slsk/shared
diff --git a/bin/build b/bin/build
index 19cb7043..4d1bf53b 100755
--- a/bin/build
+++ b/bin/build
@@ -24,19 +24,8 @@ cp -r build/* ../slskd/wwwroot/
cd ../slskd
echo $'\n> pwd\n'
pwd
-echo $'\n> dotnet publish --configuration Release\n'
-dotnet publish --configuration Release
+echo $'\n> dotnet build --configuration Release\n'
-# build docker
-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 slskd/slskd:'$tag$' slskd/sldkd:latest\n'
- docker tag slskd/slskd:$tag slskd/slskd:latest
-fi
+dotnet build --configuration Release
-echo build succeded. \ No newline at end of file
+echo $'\nbuild succeded.' \ No newline at end of file
diff --git a/bin/start b/bin/start
deleted file mode 100755
index 045c02b6..00000000
--- a/bin/start
+++ /dev/null
@@ -1,15 +0,0 @@
-docker run -d \
- -p 5000:5000 \
- -p 50000:50000 \
- -v $SLSK_OUTPUT_DIR:/var/slsk/download \
- -v $SLSK_SHARED_DIR:/var/slsk/shared \
- -e "SLSK_USERNAME=$SLSK_USERNAME" \
- -e "SLSK_PASSWORD=$SLSK_PASSWORD" \
- -e "SLSK_LISTEN_PORT=50000" \
- -e "SLSK_ENABLE_DNET=true" \
- -e "SLSK_DNET_CHILD_LIMIT=10" \
- -e "SLSK_DIAGNOSTIC=Info" \
- -e "SLSK_CONNECT_TIMEOUT=5000" \
- -e "SLSK_INACTIVITY_TIMEOUT=15000" \
- --name slskd \
- slskd/slskd:latest \ No newline at end of file
diff --git a/src/web/package.json b/src/web/package.json
index 77ba7669..50031ae8 100644
--- a/src/web/package.json
+++ b/src/web/package.json
@@ -18,6 +18,7 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
+ "test-unattended": "react-scripts test --watchAll false --passWithNoTests",
"eject": "react-scripts eject"
},
"eslintConfig": {