From 70d2713643b5d4834c5c78c0c589a12a52d786d7 Mon Sep 17 00:00:00 2001 From: Karbob Date: Sat, 19 Nov 2022 17:39:25 +0800 Subject: [PATCH] refactor(dockerfile): use `awk` to find NCMAPI version --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ac22342..a2f91f1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,9 +39,10 @@ RUN echo $'server { \n\ COPY --from=build /app/package.json /usr/local/lib/ -RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.14/main libuv jq \ +RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.14/main libuv \ && apk add --no-cache --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.14/main nodejs npm \ - && npm i -g NeteaseCloudMusicApi@"$(jq -r '.dependencies.NeteaseCloudMusicApi' /usr/local/lib/package.json)" + && npm i -g $(awk -F \" '{if($2=="NeteaseCloudMusicApi") print $2"@"$4}' /usr/local/lib/package.json) \ + && rm -f /usr/local/lib/package.json COPY --from=build /app/dist /usr/share/nginx/html