feat(byhlc112): add project deployment configuration
This commit is contained in:
93
deploy/docker/integral-resell/h5.Dockerfile
Normal file
93
deploy/docker/integral-resell/h5.Dockerfile
Normal file
@@ -0,0 +1,93 @@
|
||||
# =============================================================
|
||||
# 寄卖商城 H5 静态站运行时镜像
|
||||
# 静态文件通过 bind-mount 挂入 /usr/share/nginx/html
|
||||
# =============================================================
|
||||
|
||||
FROM nginx:1.25-alpine
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
|
||||
&& apk add --no-cache tzdata \
|
||||
&& cp /usr/share/zoneinfo/$TZ /etc/localtime \
|
||||
&& echo $TZ > /etc/timezone \
|
||||
&& rm -f /etc/apk/cache/*.apk
|
||||
|
||||
RUN cat > /etc/nginx/conf.d/default.conf <<'NGX'
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
client_max_body_size 50m;
|
||||
|
||||
location ~* \.(?:js|css|png|jpg|jpeg|gif|svg|woff2?|ttf|map|pdf)$ {
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, max-age=2592000";
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://integral-houtai:8785/api/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_read_timeout 120s;
|
||||
client_max_body_size 50m;
|
||||
}
|
||||
|
||||
location /upload/ {
|
||||
proxy_pass http://integral-houtai:8785/upload/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_read_timeout 120s;
|
||||
client_max_body_size 50m;
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
NGX
|
||||
|
||||
RUN cat > /docker-entrypoint.d/90-integral-configs.sh <<'SH' \
|
||||
&& chmod +x /docker-entrypoint.d/90-integral-configs.sh
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
CONFIG_FILE=/usr/share/nginx/html/static/configs.js
|
||||
|
||||
[ -f "$CONFIG_FILE" ] || exit 0
|
||||
|
||||
escape_sed() {
|
||||
printf '%s' "$1" | sed 's/[\/&]/\\&/g'
|
||||
}
|
||||
|
||||
replace_js_string() {
|
||||
key="$1"
|
||||
value="$2"
|
||||
[ -n "$value" ] || return 0
|
||||
sed -i -E "s#(${key}:[[:space:]]*)'[^']*'#\1'$(escape_sed "$value")'#" "$CONFIG_FILE"
|
||||
}
|
||||
|
||||
replace_js_number() {
|
||||
key="$1"
|
||||
value="$2"
|
||||
[ -n "$value" ] || return 0
|
||||
sed -i -E "s#(${key}:[[:space:]]*)[0-9]+#\1${value}#" "$CONFIG_FILE"
|
||||
}
|
||||
|
||||
replace_js_string TITLE "${INTEGRAL_TITLE:-}"
|
||||
replace_js_string BASE_URL "${INTEGRAL_API_PUBLIC_URL:-}/api"
|
||||
replace_js_string IMG_URL "${INTEGRAL_IMG_PUBLIC_URL:-}"
|
||||
replace_js_string H5_URL "${INTEGRAL_H5_PUBLIC_URL:-}"
|
||||
replace_js_number sn_id "${INTEGRAL_SN_ID:-}"
|
||||
replace_js_string appStr "${INTEGRAL_APP_STR:-}"
|
||||
SH
|
||||
|
||||
EXPOSE 80
|
||||
20
deploy/docker/integral-resell/houtai.Dockerfile
Normal file
20
deploy/docker/integral-resell/houtai.Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
||||
# =============================================================
|
||||
# 寄卖商城 Webman 后端运行时镜像
|
||||
# 应用目录通过 bind-mount 挂入 /app,镜像只提供基础运行环境
|
||||
# =============================================================
|
||||
|
||||
FROM alpine:3.19
|
||||
|
||||
ENV TZ=Asia/Shanghai
|
||||
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
|
||||
&& apk add --no-cache bash curl tzdata ca-certificates \
|
||||
&& cp /usr/share/zoneinfo/$TZ /etc/localtime \
|
||||
&& echo $TZ > /etc/timezone \
|
||||
&& rm -f /etc/apk/cache/*.apk
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
EXPOSE 8785
|
||||
|
||||
CMD ["sh", "-c", "chmod +x /app/webman.bin && exec /app/webman.bin start"]
|
||||
Reference in New Issue
Block a user