mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-22 22:16:18 +08:00
perf: display border status color when the form is verified incorrectly (#4407)
* perf: display border status color when the form is verified incorrectly * chore: adjust the document preview file order
This commit is contained in:
31
scripts/deploy/Dockerfile
Normal file
31
scripts/deploy/Dockerfile
Normal file
@@ -0,0 +1,31 @@
|
||||
FROM node:20-slim AS builder
|
||||
|
||||
# --max-old-space-size
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
ENV NODE_OPTIONS=--max-old-space-size=8192
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
RUN corepack enable
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# copy package.json and pnpm-lock.yaml to workspace
|
||||
COPY . /app
|
||||
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||
RUN pnpm run build
|
||||
|
||||
RUN echo "Builder Success 🎉"
|
||||
|
||||
FROM nginx:stable-alpine as production
|
||||
|
||||
RUN echo "types { application/javascript js mjs; }" > /etc/nginx/conf.d/mjs.conf
|
||||
COPY --from=builder /app/playground/dist /usr/share/nginx/html
|
||||
|
||||
COPY ./nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
# start nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
55
scripts/deploy/build-local-docker-image.sh
Executable file
55
scripts/deploy/build-local-docker-image.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
LOG_FILE=${SCRIPT_DIR}/build-local-docker-image.log
|
||||
ERROR=""
|
||||
IMAGE_NAME="vben-admin-local"
|
||||
|
||||
function stop_and_remove_container() {
|
||||
# Stop and remove the existing container
|
||||
docker stop ${IMAGE_NAME} >/dev/null 2>&1
|
||||
docker rm ${IMAGE_NAME} >/dev/null 2>&1
|
||||
}
|
||||
|
||||
function remove_image() {
|
||||
# Remove the existing image
|
||||
docker rmi vben-admin-pro >/dev/null 2>&1
|
||||
}
|
||||
|
||||
function install_dependencies() {
|
||||
# Install all dependencies
|
||||
cd ${SCRIPT_DIR}
|
||||
pnpm install || ERROR="install_dependencies failed"
|
||||
}
|
||||
|
||||
function build_image() {
|
||||
# build docker
|
||||
docker build . -f Dockerfile -t ${IMAGE_NAME} || ERROR="build_image failed"
|
||||
}
|
||||
|
||||
function log_message() {
|
||||
if [[ ${ERROR} != "" ]];
|
||||
then
|
||||
>&2 echo "build failed, Please check build-local-docker-image.log for more details"
|
||||
>&2 echo "ERROR: ${ERROR}"
|
||||
exit 1
|
||||
else
|
||||
echo "docker image with tag '${IMAGE_NAME}' built sussessfully. Use below sample command to run the container"
|
||||
echo ""
|
||||
echo "docker run -d -p 8010:8080 --name ${IMAGE_NAME} ${IMAGE_NAME}"
|
||||
fi
|
||||
}
|
||||
|
||||
echo "Info: Stopping and removing existing container and image" | tee ${LOG_FILE}
|
||||
stop_and_remove_container
|
||||
remove_image
|
||||
|
||||
echo "Info: Installing dependencies" | tee -a ${LOG_FILE}
|
||||
install_dependencies 1>> ${LOG_FILE} 2>> ${LOG_FILE}
|
||||
|
||||
if [[ ${ERROR} == "" ]]; then
|
||||
echo "Info: Building docker image" | tee -a ${LOG_FILE}
|
||||
build_image 1>> ${LOG_FILE} 2>> ${LOG_FILE}
|
||||
fi
|
||||
|
||||
log_message | tee -a ${LOG_FILE}
|
75
scripts/deploy/nginx.conf
Normal file
75
scripts/deploy/nginx.conf
Normal file
@@ -0,0 +1,75 @@
|
||||
|
||||
#user nobody;
|
||||
worker_processes 1;
|
||||
|
||||
#error_log logs/error.log;
|
||||
#error_log logs/error.log notice;
|
||||
#error_log logs/error.log info;
|
||||
|
||||
#pid logs/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
types {
|
||||
application/javascript js mjs;
|
||||
text/css css;
|
||||
text/html html;
|
||||
}
|
||||
|
||||
sendfile on;
|
||||
# tcp_nopush on;
|
||||
|
||||
#keepalive_timeout 0;
|
||||
# keepalive_timeout 65;
|
||||
|
||||
# gzip on;
|
||||
# gzip_buffers 32 16k;
|
||||
# gzip_comp_level 6;
|
||||
# gzip_min_length 1k;
|
||||
# gzip_static on;
|
||||
# gzip_types text/plain
|
||||
# text/css
|
||||
# application/javascript
|
||||
# application/json
|
||||
# application/x-javascript
|
||||
# text/xml
|
||||
# application/xml
|
||||
# application/xml+rss
|
||||
# text/javascript; #设置压缩的文件类型
|
||||
# gzip_vary on;
|
||||
|
||||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
index index.html;
|
||||
# Enable CORS
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
add_header 'Content-Type' 'text/plain charset=UTF-8';
|
||||
add_header 'Content-Length' 0;
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user