生产docker部署
This commit is contained in:
27
Dockerfile
Normal file
27
Dockerfile
Normal 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
|
||||
Reference in New Issue
Block a user