Skip to content

Commit 58a8ef9

Browse files
authored
feat: use npmmirror for nodejs package managers (#2356)
* misc: Make docker linter happy * feat: use npmmirror for yarn deps * feat: use npmirror for npm
1 parent 2c007ed commit 58a8ef9

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

Dockerfile

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
1-
FROM node:16.13.1-alpine as build
1+
FROM node:16.13.1-alpine AS build
22
ENV VUE_APP_NETEASE_API_URL=/api
33
WORKDIR /app
44
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories &&\
55
apk add --no-cache python3 make g++ git
66
COPY package.json yarn.lock ./
7-
RUN yarn install
8-
COPY . .
97
RUN yarn config set electron_mirror https://npmmirror.com/mirrors/electron/ && \
10-
yarn build
8+
yarn config set registry https://registry.npmmirror.com && \
9+
sed -i 's/registry.yarnpkg.com/registry.npmmirror.com/g' yarn.lock && \
10+
sed -i 's/registry.npmjs.org/registry.npmmirror.com/g' yarn.lock && \
11+
yarn install
12+
COPY . .
13+
RUN yarn build
1114

12-
FROM nginx:1.20.2-alpine as app
15+
FROM nginx:1.20.2-alpine AS app
1316

1417
COPY --from=build /app/package.json /usr/local/lib/
1518

16-
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories &&\
17-
apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.14/main libuv \
18-
&& apk add --no-cache --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.14/main nodejs npm \
19+
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories \
20+
&& apk add --no-cache libuv nodejs npm \
21+
&& npm config set registry https://registry.npmmirror.com \
1922
&& npm i -g $(awk -F \" '{if($2=="NeteaseCloudMusicApi") print $2"@"$4}' /usr/local/lib/package.json) \
2023
&& rm -f /usr/local/lib/package.json
2124

2225
COPY --from=build /app/docker/nginx.conf.example /etc/nginx/conf.d/default.conf
2326
COPY --from=build /app/dist /usr/share/nginx/html
2427

25-
CMD nginx ; exec npx NeteaseCloudMusicApi
28+
CMD ["sh", "-c", "nginx && exec npx NeteaseCloudMusicApi"]

0 commit comments

Comments
 (0)