23 lines
534 B
Docker
23 lines
534 B
Docker
# syntax=docker/dockerfile:1
|
|
FROM node:20-alpine AS build
|
|
|
|
# npm 国内加速;可通过 build arg 覆盖。
|
|
ARG NPM_REGISTRY=https://registry.npmmirror.com
|
|
|
|
WORKDIR /app/web
|
|
COPY web/package.json web/package-lock.json ./
|
|
RUN npm config set registry "$NPM_REGISTRY" \
|
|
&& npm config set replace-registry-host always \
|
|
&& npm ci --no-audit --no-fund
|
|
|
|
COPY web/ ./
|
|
RUN npm run build
|
|
|
|
|
|
FROM nginx:1.27-alpine
|
|
|
|
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
|
|
COPY --from=build /app/web/dist /usr/share/nginx/html
|
|
|
|
EXPOSE 80
|