init
This commit is contained in:
parent
3cdddc4533
commit
d59c0269d1
|
|
@ -0,0 +1,7 @@
|
|||
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
|
||||
cd ${SHELL_FOLDER}
|
||||
|
||||
# 编译后端
|
||||
sh ./server/docker_build_server.sh
|
||||
# 编译前段
|
||||
sh ./portal/docker_build_portal.sh
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
FROM nginx:1.21.6
|
||||
|
||||
MAINTAINER portal
|
||||
WORKDIR /app/portal
|
||||
|
||||
COPY ./marketing-ui/admin-ui/dist-prod /app/portal/dist
|
||||
|
||||
COPY scripts/portal/nginx.template /etc/nginx/nginx.template
|
||||
|
||||
ENV GATEWAY_BACKEND_URL http://127.0.0.1:8089
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT envsubst '${GATEWAY_BACKEND_URL}' < /etc/nginx/nginx.template > /etc/nginx/nginx.conf && cat /etc/nginx/nginx.conf && nginx -g 'daemon off;'
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
# 参数信息
|
||||
version='v1.0.0'
|
||||
current_date=$(date "+%Y%m%d")
|
||||
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
|
||||
cd ${SHELL_FOLDER}
|
||||
# 编译项目
|
||||
cd ../../marketing-ui/admin-ui/ && npm install && npm run build:prod && cd ../../
|
||||
docker build -f scripts/portal/Dockerfile -t xmodel/marketing-portal:${version}-${current_date} .
|
||||
# 重命名镜像
|
||||
portal_registry=registry.cn-hangzhou.aliyuncs.com/xmodel/marketing-portal:${version}-${current_date}-release
|
||||
docker tag xmodel/marketing-portal:${version}-${current_date} "${portal_registry}"
|
||||
# 打印仓库地址
|
||||
echo "docker push ${portal_registry}"
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
worker_processes 1;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
etag off;
|
||||
sendfile on;
|
||||
keepalive_timeout 300;
|
||||
client_header_timeout 300s;
|
||||
client_body_timeout 300s;
|
||||
client_max_body_size 100M;
|
||||
|
||||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
root /app/portal/dist;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
root /app/portal/dist;
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location ~ .*\.(css|js|json|png|jpg|jpeg|gif)$ {
|
||||
root /app/portal/dist;
|
||||
if (-f $request_filename) {
|
||||
expires 11111d;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass ${GATEWAY_BACKEND_URL}/api/;
|
||||
proxy_connect_timeout 300;
|
||||
proxy_send_timeout 600;
|
||||
proxy_read_timeout 600;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root html;
|
||||
}
|
||||
}
|
||||
|
||||
include conf.d/*;
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
FROM openjdk:17.0.2-slim
|
||||
MAINTAINER marketing
|
||||
WORKDIR /app/marketing
|
||||
|
||||
COPY scripts/server/entrypoint.sh /app/marketing/
|
||||
COPY scripts/server/fonts/* /usr/share/fonts/
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends fontconfig && fc-cache -fv \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/* && ln -snf /usr/share/zoneinfo/Hongkong /etc/localtime
|
||||
RUN chmod +x /app/marketing/entrypoint.sh && mkdir -p /app/marketing/conf/
|
||||
|
||||
COPY marketing-admin-server/src/main/resources/application.yaml /app/marketing/conf/
|
||||
COPY marketing-admin-server/src/main/resources/application-docker.yaml /app/marketing/conf/
|
||||
COPY marketing-admin-server/target/marketing-admin-server.jar /app/marketing/marketing-admin-server.jar
|
||||
|
||||
EXPOSE 8089
|
||||
ENTRYPOINT ["/app/marketing/entrypoint.sh"]
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
# 参数信息
|
||||
version='v1.0.0'
|
||||
current_date=$(date "+%Y%m%d")
|
||||
SHELL_FOLDER=$(cd "$(dirname "$0")";pwd)
|
||||
cd ${SHELL_FOLDER}
|
||||
#编译项目
|
||||
cd ../../
|
||||
mvn clean package -DskipTests -Pdocker
|
||||
#编译
|
||||
docker build -f scripts/server/Dockerfile -t xmodel/marketing-server:${version}-${current_date} .
|
||||
#仓库地址
|
||||
model_registry=registry.cn-hangzhou.aliyuncs.com/xmodel/marketing-server:${version}-${current_date}-release
|
||||
#重命名镜像
|
||||
docker tag xmodel/marketing-server:${version}-${current_date} "${model_registry}"
|
||||
#打印
|
||||
echo "docker push ${model_registry}"
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
#!/bin/sh
|
||||
|
||||
SPRING_PROFILE_CONFIG=""
|
||||
|
||||
################################################## active config start #################################################
|
||||
if [ "${PROFILE}" ];then
|
||||
SPRING_PROFILE_CONFIG="${SPRING_PROFILE_CONFIG} -Dspring.profiles.active='$PROFILE'"
|
||||
else
|
||||
SPRING_PROFILE_CONFIG="${SPRING_PROFILE_CONFIG} -Dspring.profiles.active='docker'"
|
||||
fi
|
||||
################################################## active config end ###################################################
|
||||
|
||||
################################################## spring config location start ########################################
|
||||
if [ "${SPRING_CONFIG_LOCATION}" ];then
|
||||
SPRING_PROFILE_CONFIG="${SPRING_PROFILE_CONFIG} -Dspring.config.additional-location='$SPRING_CONFIG_LOCATION'"
|
||||
else
|
||||
SPRING_PROFILE_CONFIG="${SPRING_PROFILE_CONFIG} -Dspring.config.additional-location='/app/magic-api/conf/'"
|
||||
fi
|
||||
################################################## spring config location end #########################################
|
||||
|
||||
################################################## timezone config start #################################################
|
||||
if [ "${SPRING_USER_TIMEZONE}" ];then
|
||||
SPRING_PROFILE_CONFIG="${SPRING_PROFILE_CONFIG} -Duser.timezone='$SPRING_USER_TIMEZONE'"
|
||||
else
|
||||
SPRING_PROFILE_CONFIG="${SPRING_PROFILE_CONFIG} -Duser.timezone='GMT+08'"
|
||||
fi
|
||||
################################################## timezone config end ###################################################
|
||||
|
||||
sh -c "java -server ${SPRING_PROFILE_CONFIG} ${SPRING_OPTS} ${JAVA_OPTS} -jar /app/marketing/marketing-admin-server.jar"
|
||||
Binary file not shown.
Loading…
Reference in New Issue