Skip to content

Commit

Permalink
修改编译Dockerfile文件
Browse files Browse the repository at this point in the history
  • Loading branch information
Dot-Liu committed May 8, 2024
1 parent 9fe9fe4 commit 680fa0c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
19 changes: 9 additions & 10 deletions build/cmd/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,24 @@ RUN yum install -y wget && wget http://dl.fedoraproject.org/pub/epel/epel-releas
#声明端口
EXPOSE 9400 8099

#定义数据卷
VOLUME /var/lib/apinto

#设置环境变量
ENV APP=apinto
ARG AppName=apinto

#定义数据卷
VOLUME /var/lib/${AppName}

ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone

#解压网关程序压缩包
COPY ./apinto.linux.x64.tar.gz /
RUN tar -zxvf apinto.linux.x64.tar.gz && rm -rf apinto.linux.x64.tar.gz

#复制程序默认配置文件以及修改脚本权限
RUN mkdir /etc/apinto
RUN cp /apinto/apinto.yml.tpl /etc/apinto/apinto.yml && cp /apinto/config.yml.tpl /etc/apinto/config.yml
RUN chmod 777 /apinto/start.sh && chmod 777 /apinto/join.sh && chmod 777 /apinto/leave.sh
RUN mkdir /etc/${AppName}
RUN cp /${AppName}/${AppName}.yml.tpl /etc/${AppName}/${AppName}.yml && cp /${AppName}/config.yml.tpl /etc/${AppName}/config.yml
RUN chmod 777 /${AppName}/start.sh && chmod 777 /${AppName}/join.sh && chmod 777 /${AppName}/leave.sh

WORKDIR /apinto
WORKDIR /${AppName}

#容器启动命令
CMD sh start.sh
2 changes: 1 addition & 1 deletion build/cmd/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function buildApp(){
-X 'github.com/eolinker/apinto/utils/version.goVersion=$(go version)'
-X 'github.com/eolinker/apinto/utils/version.eoscVersion=${EOSC_VERSION}'"
echo -e "build $APP:go build -ldflags "-w -s $flags" -o ${OUTPATH}/$APP ${BasePath}/app/$APP"
CGO_ENABLED=0 go build -ldflags "-w -s $flags" -o ${OUTPATH}/$APP ${BasePath}/app/$APP
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-w -s $flags" -o ${OUTPATH}/$APP ${BasePath}/app/$APP
# echo "build $APP:${buildCMD}"

# echo `${buildCMD}`
Expand Down
17 changes: 10 additions & 7 deletions build/resources/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,28 @@ FROM centos:7.9.2009
MAINTAINER eolink

RUN yum install -y wget && wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && rpm -ivh epel-release-latest-7.noarch.rpm && yum install -y jq

#声明端口
EXPOSE 9400 8099

#设置环境变量
ARG AppName=apinto

#定义数据卷
VOLUME /var/lib/apinto
VOLUME /var/lib/${AppName}

#设置环境变量
ENV APP=apinto
RUN ln -snf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone

#解压网关程序压缩包
COPY ./apinto.linux.x64.tar.gz /
RUN tar -zxvf apinto.linux.x64.tar.gz && rm -rf apinto.linux.x64.tar.gz

#复制程序默认配置文件以及修改脚本权限
RUN mkdir /etc/apinto
RUN cp /apinto/apinto.yml.tpl /etc/apinto/apinto.yml && cp /apinto/config.yml.tpl /etc/apinto/config.yml
RUN chmod 777 /apinto/start.sh && chmod 777 /apinto/join.sh && chmod 777 /apinto/leave.sh
RUN mkdir /etc/${AppName}
RUN cp /${AppName}/${AppName}.yml.tpl /etc/${AppName}/${AppName}.yml && cp /${AppName}/config.yml.tpl /etc/${AppName}/config.yml
RUN chmod 777 /${AppName}/start.sh && chmod 777 /${AppName}/join.sh && chmod 777 /${AppName}/leave.sh

WORKDIR /apinto
WORKDIR /${AppName}

#容器启动命令
CMD sh start.sh

0 comments on commit 680fa0c

Please sign in to comment.