Write the Code. Change the World.

11月 12

https://blog.csdn.net/weixin_39938069/article/details/144372076

构建国产东方通

  1. 准备好安装包和 license。
  2. 准备 Dockerfile 文件。
FROM alpine:3.18

# 1. 安装编译依赖
RUN apk add --no-cache \
        gcc g++ make autoconf automake libtool bison flex \
        openssl-dev zlib-dev pcre-dev tar

# 2. 复制源码和 license
COPY TongHttpServer_6.0.1.5_alpine_x86_64.tar.gz /tmp/
COPY license.dat /tmp/

# 3. 解压
RUN tar -zxf /tmp/TongHttpServer_6.0.1.5_alpine_x86_64.tar.gz -C /usr/local/ && \
    cp /tmp/license.dat /usr/local/THS/ && \
    rm -f /tmp/TongHttpServer_6.0.1.5_alpine_x86_64.tar.gz && \
    rm -f /tmp/license.dat

# 4. 设置工作目录
WORKDIR /usr/local/THS

# 暴露端口,根据需要修改
EXPOSE 80 443 8011 8000

# 启动 TongHttpServer
CMD ["./bin/start.sh"]

安装包有 x86 和 arm64,请和服务器对应上。

  1. 打包镜像。Dockerfile 文件、安装包、license 文件放一起。

    docker build -t tong-http-server:6.0.1 .
  2. 运行镜像,看看效果

docker run -d --rm -p 8000:8000 -p 80:80 --name t1 \
  tong-http-server:6.0.1 \
  /bin/sh -c "./bin/start.sh && ./bin/startConsole.sh && tail -f /dev/null"

# 进入容器查看
docker exec -it t1 bash

浏览器访问 http://localhost:8000 进入控制台。

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注