zoukankan      html  css  js  c++  java
  • Kbengine游戏引擎-【5】用Dockerfile打包镜像kbengine

    本文是以docker为例,以ubuntu 16.04做基础镜像

    kengine 1.0.0 用supervisor来管理启动


    先放下目录结构图:

    kb--里面放的是kbengine的编译后的引擎以及demo

    参考案例:https://github.com/Yenole/kbengine-docker/blob/master/Dockerfile

    不过他这个写的我没实现成功

    一、Dockerfile文件

    FROM ubuntu:16.04
    LABEL maintainer="116.com"
    # 设置工作目录
    WORKDIR /
    # 更新并安装环境
    RUN apt update
    RUN apt install libmysqlclient-dev -y           #数据库管理器(DBMgr)会用到,不然这个进程起不了,无法连接数据库
    RUN apt install mysql-client -y
    #解压安装引擎
    COPY kb /
    # 添加demo
    RUN useradd kbe #安装supervisord #让supervisord启动在前端,这样不会down掉 RUN apt install supervisor
    -y RUN chmod 777 /etc/supervisor/supervisord.conf COPY supervisord.conf /etc/supervisor/supervisord.conf # 映射端口 EXPOSE 20013 EXPOSE 20015 EXPOSE 8000 CMD ["/usr/bin/supervisord","-n","-c","/etc/supervisor/supervisord.conf"]

    二.supervisord.conf文件

    ; supervisor config file
    
    [unix_http_server]
    file=/var/run/supervisor.sock   ; (the path to the socket file)
    chmod=0755                       ; sockef file mode (default 0700)
    
    [supervisord]
    logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
    pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
    childlogdir=/var/log/supervisor            ; ('AUTO' child log dir, default $TEMP)
    
    ; the below section must remain in the config file for RPC
    ; (supervisorctl/web interface) to work, additional interfaces may be
    ; added by defining them in separate rpcinterface: sections
    [rpcinterface:supervisor]
    supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
    
    [supervisorctl]
    serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL  for a unix socket
    
    ; The [include] section can just contain the "files" setting.  This
    ; setting can list multiple files (separated by whitespace or
    ; newlines).  It can also contain wildcards.  The filenames are
    ; interpreted as relative to this file.  Included files *cannot*
    ; include files themselves.
    
    [include]
    files = /etc/supervisor/conf.d/*.conf
    [program:kbe2]
    user=kbe
    environment=uid="1000",KBE_ROOT="/kbengine",KBE_RES_PATH="$KBE_ROOT/assets/:$KBE_ROOT/assets/scripts/:$KBE_ROOT/assets/res/",KBE_BIN_PATH="$KBE_ROOT/kbe/bin/server"
    directory=/kbengine/assets/
    command=/bin/sh start_server.sh
    autostart=true
    autorestart=true
    [program:django]
    directory=/kbengine/kbe/tools/server/webconsole/
    command=/bin/sh run_server.sh
    autostart=true
    autorestart=true

    三、构建镜像

    docker build -t kbengine:v1 .

    四、注意事项

    1.提先要把数据库准备好,建好库已经用户密码。

    2.环境变量问题

  • 相关阅读:
    用C#发邮件
    .Net WinForm datagridview中无法输入中文总结
    6、linux上安装kafka
    10、linux上安装hive
    8、linux上安装hbase
    4、linux 上安装mysql
    3、hadoop的分布式安装
    12、Ambari 环境搭建
    mybtais获取插入数据的主键id
    mybatis高级映射
  • 原文地址:https://www.cnblogs.com/geekmao/p/7992731.html
Copyright © 2011-2022 走看看