# ============================================================= # 寄卖商城 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 js_escape() { printf '%s' "$1" | awk '{ gsub(/\\/, "\\\\"); gsub("\047", "\\\047"); printf "%s", $0 }' } mkdir -p "$(dirname "$CONFIG_FILE")" cat > "$CONFIG_FILE" <