生产docker部署

This commit is contained in:
andy
2026-06-30 10:57:21 +08:00
parent 898a1e1577
commit 46a8bf3c07
6 changed files with 152 additions and 0 deletions

27
Dockerfile Normal file
View File

@@ -0,0 +1,27 @@
FROM node:20-alpine AS build
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY . .
ARG BUILD_MODE=prod
RUN case "$BUILD_MODE" in \
test) yarn build:test ;; \
prod|production) yarn build:prod ;; \
*) echo "Unsupported BUILD_MODE: $BUILD_MODE. Use test or prod." && exit 1 ;; \
esac
FROM nginx:1.27-alpine
ENV BACKEND_GATEWAY=http://192.168.3.211:9999
COPY nginx/default.conf.template /etc/nginx/templates/default.conf.template
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 10086
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s \
CMD wget -qO- http://127.0.0.1:10086/ >/dev/null || exit 1