From e470055e432b5d7e4286b5841814562372b48558 Mon Sep 17 00:00:00 2001 From: Sin <13870295+sino1641@users.noreply.github.com> Date: Thu, 26 Dec 2024 01:02:22 +0800 Subject: [PATCH 1/3] misc: Make docker linter happy --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2fb8f95c4c..3900771d9a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:16.13.1-alpine as build +FROM node:16.13.1-alpine AS build ENV VUE_APP_NETEASE_API_URL=/api WORKDIR /app RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories &&\ @@ -9,7 +9,7 @@ COPY . . RUN yarn config set electron_mirror https://npmmirror.com/mirrors/electron/ && \ yarn build -FROM nginx:1.20.2-alpine as app +FROM nginx:1.20.2-alpine AS app COPY --from=build /app/package.json /usr/local/lib/ @@ -22,4 +22,4 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/re COPY --from=build /app/docker/nginx.conf.example /etc/nginx/conf.d/default.conf COPY --from=build /app/dist /usr/share/nginx/html -CMD nginx ; exec npx NeteaseCloudMusicApi \ No newline at end of file +CMD ["sh", "-c", "nginx && exec npx NeteaseCloudMusicApi"] From a1f28d53406e197ccb8383787bdd645960b5c243 Mon Sep 17 00:00:00 2001 From: Sin <13870295+sino1641@users.noreply.github.com> Date: Thu, 26 Dec 2024 01:31:13 +0800 Subject: [PATCH 2/3] feat: use npmmirror for yarn deps --- Dockerfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3900771d9a..bf9fa99de0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,10 +4,13 @@ WORKDIR /app RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories &&\ apk add --no-cache python3 make g++ git COPY package.json yarn.lock ./ -RUN yarn install -COPY . . RUN yarn config set electron_mirror https://npmmirror.com/mirrors/electron/ && \ - yarn build + yarn config set registry https://registry.npmmirror.com && \ + sed -i 's/registry.yarnpkg.com/registry.npmmirror.com/g' yarn.lock && \ + sed -i 's/registry.npmjs.org/registry.npmmirror.com/g' yarn.lock && \ + yarn install +COPY . . +RUN yarn build FROM nginx:1.20.2-alpine AS app From 51ec158b1899b38a60858dcf7ee632407473a608 Mon Sep 17 00:00:00 2001 From: Sin <13870295+sino1641@users.noreply.github.com> Date: Thu, 26 Dec 2024 01:53:15 +0800 Subject: [PATCH 3/3] feat: use npmirror for npm --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index bf9fa99de0..654461376a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,9 +16,9 @@ FROM nginx:1.20.2-alpine AS app COPY --from=build /app/package.json /usr/local/lib/ -RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories &&\ - 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 \ +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories \ + && apk add --no-cache libuv nodejs npm \ + && npm config set registry https://registry.npmmirror.com \ && npm i -g $(awk -F \" '{if($2=="NeteaseCloudMusicApi") print $2"@"$4}' /usr/local/lib/package.json) \ && rm -f /usr/local/lib/package.json