From ddc94e5a5d1b53dd38cd7a55f8f28db838138462 Mon Sep 17 00:00:00 2001 From: caiyuchao Date: Thu, 17 Apr 2025 20:58:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20gateway=E9=83=A8=E7=BD=B2=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/docker/compose/docker-compose.yml | 8 +++++-- build/docker/license-server/generatelic.sh | 16 +++++++++++-- build/docker/wfc/gateway/dockerfile | 27 ++++++++++++++++++++-- 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/build/docker/compose/docker-compose.yml b/build/docker/compose/docker-compose.yml index dd76683..b6afac9 100644 --- a/build/docker/compose/docker-compose.yml +++ b/build/docker/compose/docker-compose.yml @@ -86,18 +86,22 @@ services: restart: ${RESTART_OPTION} wfc-gateway: - image: wfc-java:jre8 + build: + context: ./wfc/gateway container_name: wfc-gateway ports: - "${GATEWAY_SERVER_PORT}:${GATEWAY_SERVER_PORT}" networks: - - wfc-be-network + - wfc-be-network + privileged: true volumes: - ./wfc/gateway/jar/wfc-gateway.jar:/opt/wfc/app.jar - ./conf/application-common.yml:/opt/wfc/conf/application-common.yml - ./conf/i18n/:/opt/wfc/conf/i18n - ./wfc/gateway/conf/application.yml:/opt/wfc/conf/application.yml - ./conf/license:/opt/wfc/license + - /sbin/dmidecode:/sbin/dmidecode + - /dev/mem:/dev/mem depends_on: wfc-redis: condition: service_healthy diff --git a/build/docker/license-server/generatelic.sh b/build/docker/license-server/generatelic.sh index 96ef3e0..07667ca 100755 --- a/build/docker/license-server/generatelic.sh +++ b/build/docker/license-server/generatelic.sh @@ -8,6 +8,7 @@ CPU="" MB="" IP="" MAC="" +CODE="" # 解析命令行参数 while [[ $# -gt 0 ]]; do @@ -46,6 +47,10 @@ while [[ $# -gt 0 ]]; do CPU="$2" shift 2 ;; + -code|--code) + CODE="$2" + shift 2 + ;; -mb|--mb) MB="$2" shift 2 @@ -72,14 +77,21 @@ echo "ip序列号: $MB" IP=$(printf "%s\",\"" "${IPS[@]}") IP=${IP%\",\"} +if [ ! -z "$IP" ]; then + IP=\"$IP\" +fi MAC=$(printf "%s\",\"" "${MACS[@]}") MAC=${MAC%\",\"} +if [ ! -z "$MAC" ]; then + MAC=\"$MAC\" +fi RAW='{ "expiryTime": "'$TIME'", - "ipAddress": ["'$IP'"], - "macAddress": ["'$MAC'"], + "ipAddress": ['$IP'], + "macAddress": ['$MAC'], "cpuSerial": "'$CPU'", + "activationCode": "'$CODE'", "mainBoardSerial": "'$MB'" }' diff --git a/build/docker/wfc/gateway/dockerfile b/build/docker/wfc/gateway/dockerfile index fe1f20f..fa30d21 100644 --- a/build/docker/wfc/gateway/dockerfile +++ b/build/docker/wfc/gateway/dockerfile @@ -1,5 +1,28 @@ -# 基础镜像 -FROM openjdk:8-jre +# 使用Ubuntu 22.04 LTS作为基础镜像 +FROM ubuntu:22.04 + +# 设置时区(可选) +ENV TZ=Asia/Shanghai +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +# 编码格式 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 + +# 安装OpenJDK 8 +RUN apt-get update && \ + apt-get install -y openjdk-8-jre && \ + apt-get install -y locales && \ + apt-get install -y curl && \ + locale-gen en_US.UTF-8 && \ + update-locale LANG=en_US.UTF-8 && \ + apt-get clean; + +# 设置JAVA_HOME环境变量 +ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64 +ENV PATH $JAVA_HOME/bin:$PATH + # author LABEL org.wfc.image.authors="wfc@wfc.org"