1- FROM node:16.13.1-alpine as build
1+ FROM node:16.13.1-alpine AS build
22ENV VUE_APP_NETEASE_API_URL=/api
33WORKDIR /app
44RUN 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
66COPY package.json yarn.lock ./
7- RUN yarn install
8- COPY . .
97RUN 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
1417COPY --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
2225COPY --from=build /app/docker/nginx.conf.example /etc/nginx/conf.d/default.conf
2326COPY --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