Skip to content

Commit

Permalink
refactor(dockerfile): use awk to find NCMAPI version
Browse files Browse the repository at this point in the history
  • Loading branch information
karbobc authored and pan93412 committed Dec 15, 2022
1 parent 9fcb6da commit 70d2713
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 70d2713

Please sign in to comment.