2023-12-20 14:40:39 +08:00
|
|
|
# build
|
2024-09-26 11:57:23 +08:00
|
|
|
FROM node:20-alpine AS builder
|
2023-12-20 14:40:39 +08:00
|
|
|
|
|
|
|
|
RUN apk update && apk add --no-cache git
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
COPY package*.json ./
|
|
|
|
|
|
|
|
|
|
RUN npm install
|
|
|
|
|
|
|
|
|
|
COPY . .
|
|
|
|
|
|
2024-09-26 11:57:23 +08:00
|
|
|
# add .env.example to .env
|
2023-12-20 14:40:39 +08:00
|
|
|
RUN [ ! -e ".env" ] && cp .env.example .env || true
|
|
|
|
|
|
|
|
|
|
RUN npm run build
|
|
|
|
|
|
|
|
|
|
# nginx
|
2024-09-26 11:57:23 +08:00
|
|
|
FROM nginx:1.27-alpine-slim AS app
|
2023-12-20 14:40:39 +08:00
|
|
|
|
|
|
|
|
COPY --from=builder /app/out/renderer /usr/share/nginx/html
|
|
|
|
|
|
|
|
|
|
COPY --from=builder /app/nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
|
|
|
|
|
|
RUN apk add --no-cache npm
|
|
|
|
|
|
|
|
|
|
RUN npm install -g NeteaseCloudMusicApi
|
|
|
|
|
|
|
|
|
|
CMD nginx && npx NeteaseCloudMusicApi
|