Support docker source code construction

This commit is contained in:
zhangqi
2022-02-15 10:43:11 +08:00
parent b91bec15f2
commit e4534c359f
9 changed files with 281 additions and 29 deletions

View File

@@ -0,0 +1,20 @@
ARG NODE_VERSION=12.20.0
ARG NGINX_VERSION=1.21.5-alpine
FROM node:${NODE_VERSION} AS builder
ARG OUTPUT_PATH=dist
ENV TZ Asia/Shanghai
WORKDIR /opt
COPY . .
RUN npm config set registry https://registry.npm.taobao.org \
&& npm install \
# Change the output directory to dist
&& sed -i "s#../kafka-manager-web/src/main/resources/templates#$OUTPUT_PATH#g" webpack.config.js \
&& npm run prod-build
FROM nginx:${NGINX_VERSION}
ENV TZ=Asia/Shanghai
COPY --from=builder /opt/dist /opt/dist
COPY --from=builder /opt/web.conf /etc/nginx/conf.d/default.conf

View File

@@ -0,0 +1,13 @@
server {
listen 80;
location / {
root /opt/dist;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /api {
proxy_pass http://logikm-backend:8080;
}
}